ATLAS Offline Software
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Types | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
dqutils::MonitoringFile Class Reference

#include <MonitoringFile.h>

Inheritance diagram for dqutils::MonitoringFile:
Collaboration diagram for dqutils::MonitoringFile:

Classes

class  CopyHistogram
 
class  GatherNames
 
class  GatherStatistics
 
class  HistogramOperation
 
struct  MetaData
 
class  OutputMetadata
 
class  PostProcessorFileWrapper
 

Public Types

typedef std::map< std::string, TDirectory * > DirMap_t
 

Public Member Functions

 MonitoringFile ()
 
 MonitoringFile (const std::string &fileName)
 
virtual ~MonitoringFile ()
 
void mergeDirectory (TDirectory *outputDir, const std::vector< TFile * > &inputFiles, bool has_multiple_runs=false, std::map< TFile *, std::string > *prefixes=0)
 
void mergeFiles (const std::string &outFileName, const std::vector< std::string > &files)
 
void mergeFiles (const std::string &outFileName, const std::string &listFileName)
 
virtual bool setFile (const std::string &fileName)
 Clears all previous data and opens the file with the given name for analysis, returning a boolean indicating whether the file was opened successfully or not. More...
 
virtual void printDirectories ()
 
virtual void printStatistics ()
 
virtual bool copyHistograms (const std::string &outFileName, const std::string &dirName="all")
 Copy the indicated set of histograms to an output file. More...
 
virtual void printHanConfig ()
 
virtual std::string FindCommon (const std::string &name1, const std::string &name2) const
 
bool setHistogramRegEx (const std::string &re)
 
bool setDirectoryRegEx (const std::string &re)
 
void doTiming ()
 

Static Public Member Functions

static void getAllDirs (DirMap_t &dirmap, TDirectory *dir, const std::string &dirName)
 
static TDirectory * createDir (DirMap_t &dirmap, TDirectory *dir, const std::string &parent, const std::string &path)
 
static TKey * getObjKey (TDirectory *dir, const std::string &path)
 
static void fillMetaDataMap (std::map< std::string, dqutils::MonitoringFile::MetaData > &mdMap, TDirectory *dir)
 
static void merge_effAsPerCent (TH2 &a, const TH2 &b)
 
static void merge_perBinEffPerCent (TH1 &a, const TH1 &b)
 
static void merge_effAsPerCentAlt (TH1 &a, const TH1 &b)
 
static void merge_weightedAverage (TH1 &a, const TH1 &b)
 
static void merge_weightedAverage2D (TH2 &a, const TH2 &b)
 
static void merge_weightedEff (TH1 &a, const TH1 &b)
 
static void merge_Rebinned (TH1 &a, TH1 &b)
 
static void merge_eventSample (TH2 &a, const TH2 &b)
 
static void merge_RMS (TH1 &a, const TH1 &b)
 
static void merge_RMSpercentDeviation (TH1 &a, const TH1 &b)
 
static void merge_lowerLB (TH1 &a, const TH1 &b)
 
static void merge_identical (TH1 &a, const TH1 &b)
 
static void fitMergedFile_IDPerfMonManager (const std::string &inFileName, bool isIncremental=false)
 Methods for creating ID Alignment summary plots on merged files. More...
 
static void fitMergedFile_DiMuMonManager (const std::string &inFileName, bool isIncremental=false)
 
static void fitMergedFile_IDAlignMonManager (const std::string &inFileName, bool isIncremental=false)
 
static bool CheckHistogram (TFile *f, const char *HistoName)
 
static void fitMergedFile_IDAlignMonResiduals (TFile *f, const std::string &run_dir, const std::string &TriggerName)
 
static void fitMergedFile_IDAlignMonTrackSegments (TFile *file, const std::string &run_dir, const std::string &tracksName)
 
static void fitMergedFile_IDAlignMonGenericTracks (TFile *file, const std::string &run_dir, const std::string &tracksName)
 
static void fitMergedFile_IDAlignMonPVbiases (TFile *file, const std::string &run_dir, const std::string &tracksName)
 
static void fitMergedFile_IDPerfMonKshort (TFile *f, const std::string &run_dir, const std::string &TriggerName)
 
static void fitMergedFile_IDPerfMonJpsi (TFile *f, const std::string &run_dir, const std::string &TriggerName)
 
static void fitMergedFile_IDPerfMonUpsilon (TFile *f, const std::string &run_dir, const std::string &TriggerName)
 
static void fitMergedFile_IDPerfMonZee (TFile *f, const std::string &run_dir, const std::string &TriggerName)
 
static void fitMergedFile_IDPerfMonWenu (TFile *f, const std::string &run_dir, const std::string &TriggerName)
 
static void fitMergedFile_IDPerfMonZMM (TFile *f, const std::string &run_dir, const std::string &TriggerName)
 
static void fitJpsiHistograms (TH1F *hmass, TH1F *hwidth, TH1F *h1[], int n)
 
static void fitUpsilonHistograms (TH1F *hmass, TH1F *hwidth, TH1F *h1[], int n)
 
static void fitZmumuMassPlot (TH1F *hmass)
 
static std::pair< RooRealVar, RooRealVar > fitZmumuMass (TH1F *hmass)
 
static void fitZmumuHistograms (TH1F *hmass, TH1F *hwidth, std::vector< TH1F * > hvec)
 
static void processModule (TFile *f, const std::string &run_dir, TKey *key_module, const std::string &moduleName)
 
static void fitMergedFile_DiMuMonAll (TFile *f, const std::string &run_dir, const std::string &resonName, const std::string &triggerName)
 
static void fitHistos (TH2F *hin, const std::vector< TH1F * > &hout, int mode, const std::string &triggerName, const std::string &resonName, TH1F *m_chi2)
 
static void fillGaussianMeanOrWidth (TH2F *h2d, TH1F *h, float fitMin, float fitMax, int iopt)
 
static void fillMeanOrWidth (TH2F *h2d, TH1F *h, int iopt)
 
static void fillDetPaperMeanRMS (TH2F *h2d, TH1F *h, int iopt)
 
static void meanRMSProjections2D (TH2F *h2d, TH1F *h, int iopt)
 
static void meanRMSProjections3D (TH3F *h3d, TH2F *h, int iopt)
 
static void meanRMSProjections3D_DMRPlot (TH3F *h3d, TH1F *h, int iopt)
 
static void meanRMSProjections3D_XY (TH3F *h3d, TH1F *h, int iXY, int iopt)
 
static TH1F * combineHistos (const char *name, const char *title, TObjArray *plots, int gap)
 
static void setMinWindow (TH1 *h1, float min, float max)
 
static float getMedian (TH1 *h1)
 
static void ProcessAsymHistograms (TH1F *m_neg, TH1F *m_pos, TH1F *m_asym)
 
static void Make1DProfile (TH1 *output, TH2 *histo)
 
static void MakeMap (TH2 *outputhist, TH3 *hist)
 
static int IterativeGaussFit (TH1 *hist, double &mu, double &mu_err, double &sigma, double &sigma_err)
 
static void MuonTrackPostProcess (const std::string &inFileName, bool isIncremental=false)
 
static void MuonTrack_Main (const std::string &inFileName, TString dirname)
 
static void RPCPostProcess (const std::string &inFilename, bool isIncremental=false)
 
static bool RPCCheckHistogram (TFile *f, const char *HistoName)
 
static void TGCPostProcess (const std::string &inFilename, bool isIncremental=false)
 
static void TGCChannelOccupancy (const std::string &inFilename, std::vector< std::pair< std::string, float > > &p)
 
static void TGCChamberOccupancy (const std::string &inFilename, std::vector< std::pair< std::string, float > > &phigh, std::vector< std::pair< std::string, float > > &plow)
 
static void TGCChamberEfficiency (const std::string &inFilename, std::vector< std::pair< std::string, float > > &p)
 
static void TGCChamberTiming (const std::string &inFilename, std::vector< std::pair< std::string, float > > &pro, std::vector< std::pair< std::string, float > > &ptrg)
 
static void TGCsubsectbin2stationeta (int subsect, int bin, int &station, int &eta)
 
static void TGCsubsect2sectorphi (int subsect, int &sector, int &phi4)
 
static void TGCRawHistogramDivision (const std::string &inFilename)
 
static void TGCLV1HistogramDivision (const std::string &inFilename)
 
static int nTGCWireStripMap (int ws, int etac, int phi48)
 
static int getTGCNumberOfWires (const int istationName, const int layer, const int istationEta, const int istationPhi)
 
static void TGCResetContents (TH1 *h)
 
static void MDTvsTGCPostProcess (const std::string &inFilename, bool isIncremental=false)
 
static void MDTvsTGCEfficiency (const std::string &inFilename)
 
static void MDTvsTGCResetContents (TH1 *h)
 
static bool TGCCheckHistogram (TFile *f, TString &hname)
 
static void TGCSetMetaData (TDirectory *targetDir, TH1 *h1, TH1 *h2=0, TH1 *h3=0)
 
static void HLTMuonPostProcess (const std::string &inFilename, bool isIncremental=false)
 
static void HLTMuonHistogramDivision (const std::string &inFilename, TString &run_dir)
 
static void HLTMuonTriggerOverlapMatrix (const std::string &inFilename, TString &run_dir)
 
static bool HLTMuonCheckHistogram (TFile *f, TString &hname)
 
static void HLTMuonHDiv (PostProcessorFileWrapper &mf, TString sdir, TString snum, TString sden, TString seff, TString seffg)
 
static void HLTEgammaPostProcess (const std::string &inFilename, bool isIncremental=false)
 
static void HLTEgammaEfficiencyOff (TFile *f, TDirectory *trig_dir, TDirectory *off_dir, const TString &pathNum, const TString &pathEff, const std::vector< TString > &varName)
 
static void HLTEgammaEfficiencyRel (TFile *f, TDirectory *trig_dir, const TString &pathPre, const TString &pathRej, const std::vector< TString > &objStage, const std::vector< TString > &varName)
 
static void HLTTauPostProcess (const std::string &inFilename, bool isIncremental=false)
 
static void HLTTauPostProcess (TFile *f, TDirectory *dir, TString pathApp, TString pathAppEff, const std::vector< TString > &lvlN, const std::vector< TString > &varN, const std::vector< std::pair< int, int > > &ratioIndex, int nameStyle, TString nameApp="")
 
static std::string getPath (TDirectory *dir)
 
static void HLTMETPostProcess (const std::string &inFileName, bool isIncremental=false)
 
static void HLTMETAveragePhivsEtaMaps (TFile *f, TString &run_dir)
 
static size_t HLTMETGetDQLBNRange (TDirectory *&run_dir, std::vector< TString > &lbnDirs)
 
static int HLTMETGetStatusPerBin (TH1I *&hist, int ymin, int ymax, int rmin, int rmax)
 
static void HLTMETDQFlagSummary (TFile *f, TString &run_dir)
 
static void HLTCaloPostProcess (const std::string &inFileName, bool isIncremental=false)
 
static void HLTCaloAveragePtPhiEtaMaps (TFile *f, TString &run_dir)
 
static void HLTJetPostProcess (const std::string &inFileName, bool isIncremental=false)
 
static void HLTJetCalcEfficiencyAndRate (TFile *f, TString &run_dir)
 
static void BJetTaggingPostProcess (const std::string &inFileName, bool isIncremental=false)
 
static void BJetTaggingAdjustRanges (TFile *f)
 
static void BJetTaggingNormalise (TFile *f)
 
static void HLTMinBiasMonPostProcess (const std::string &inFileName, bool isIncremental=false)
 
static void HLTMinBiasMonGetTargetHistos (TDirectory *source, std::vector< std::pair< TString, TString > > &targetNames)
 
static void pv_PrimaryVertexMonitoring_calcResoAndEfficiency (const std::string &inFilename, bool isIncremental=false)
 
static void VxMon_move (const std::string &inFilename, bool isIncremental=false)
 
static void L1CaloPostProcess (const std::string &inFileName, bool isIncremental=false)
 
static void L1CaloStabilityRMS (TFile *f, const TString &nameDir, const TString &nameTag)
 
static void L1CaloFillWithError (TFile *f, const TString &nameDir, const TString &nameData, const TString &nameError)
 
static void L1CaloResetEfficiencies (TFile *f, const TString &effDir, const TString &nameDen, const TString &nameEff, int items, double threshold, int binSkip)
 
static void PixelPostProcess (const std::string &inFilename, bool isIncremental=false)
 
static int ComputeUPXBinErrors (TH1F *hnum, TH1F *hden, std::vector< float > &errors)
 
static std::string getHanResults (const std::string &hanResultsDir, const std::string &input, const std::string &hcfg, const std::string &hcfg_min10, const std::string &hcfg_min30)
 
static int mergeLBintervals (const std::string &, const std::string &debugLevel="none")
 
static int getDebugLevel ()
 
static void setDebugLevel (int level)
 
static int getCompressionLevel ()
 
static void setCompressionLevel (int level)
 

Protected Member Functions

virtual void clearData ()
 

Static Protected Member Functions

static std::string getIndentation (const std::string &pathName, const std::string &leadingSpace="")
 
static bool dirHasHistogramsInMetadata (TDirectory *dir)
 
static void loopOnHistograms (HistogramOperation &fcn, TDirectory *dir)
 
static bool loopOnHistogramsInMetadata (HistogramOperation &fcn, TDirectory *dir)
 
static bool setListFromFile (std::vector< std::string > &filelist, const std::string &listFileName)
 

Protected Attributes

TFile * m_file {}
 

Private Types

enum  debugLevel_t { none = 0, DEBUG, VERBOSE }
 
typedef std::map< TDirectory *, std::vector< TDirectory * > > map_dir_vdir
 

Static Private Member Functions

static void mergeObjsMultiCycles (const std::string &, const std::vector< int > &, TDirectory *, const std::string &, std::unique_ptr< TObject > &)
 
static int mergeObjs (TObject *, TObject *, const std::string &, debugLevel_t debugLevel=none, const std::string &path="")
 
static int mergeLB_createListOfHistos (TDirectory *, TDirectory *, std::vector< std::string > &, debugLevel_t &)
 
static int mergeLB_recursiveDirCopy (TDirectory *, TDirectory *, TDirectory *, std::vector< std::string > &, debugLevel_t &)
 
static int mergeLB_processLBinterval (std::vector< TDirectory * > &, TDirectory *, debugLevel_t &)
 
static void buildLBToIntervalMap (std::vector< TDirectory * > &, std::vector< TDirectory * > &, map_dir_vdir &, debugLevel_t &)
 
static int mergeLB_processLB (std::vector< TDirectory * > &, std::vector< TDirectory * > &, debugLevel_t &)
 
static int mergeLB_processRun (TDirectory *, debugLevel_t &)
 
static Int_t getNumBins (const TH1 &hist)
 

Private Attributes

std::regex * m_mergeMatchHistoRE {}
 
std::regex * m_mergeMatchDirRE {}
 
std::string m_mergeMatchHistoREString
 
std::string m_mergeMatchDirREString
 
bool m_useRE {}
 

Static Private Attributes

static std::atomic< int > m_debugLevel
 
static std::atomic< int > m_fileCompressionLevel
 
static bool m_doTiming
 
static std::unordered_map< std::string, std::clock_t > m_cpuPerHistogram
 

Detailed Description

Definition at line 54 of file MonitoringFile.h.

Member Typedef Documentation

◆ DirMap_t

typedef std::map< std::string, TDirectory* > dqutils::MonitoringFile::DirMap_t

Definition at line 88 of file MonitoringFile.h.

◆ map_dir_vdir

typedef std::map<TDirectory*, std::vector<TDirectory*> > dqutils::MonitoringFile::map_dir_vdir
private

Definition at line 427 of file MonitoringFile.h.

Member Enumeration Documentation

◆ debugLevel_t

Enumerator
none 
DEBUG 
VERBOSE 

Definition at line 424 of file MonitoringFile.h.

424  {
425  none = 0, DEBUG, VERBOSE
426  };

Constructor & Destructor Documentation

◆ MonitoringFile() [1/2]

dqutils::MonitoringFile::MonitoringFile ( )

◆ MonitoringFile() [2/2]

dqutils::MonitoringFile::MonitoringFile ( const std::string &  fileName)

◆ ~MonitoringFile()

virtual dqutils::MonitoringFile::~MonitoringFile ( )
virtual

Member Function Documentation

◆ BJetTaggingAdjustRanges()

void dqutils::MonitoringFile::BJetTaggingAdjustRanges ( TFile *  f)
static

Definition at line 27 of file MonitoringFile_BJetTaggingAdjustRanges.cxx.

27  {
29 
30  if (debugLevel > 1) {
31  std::cout << "--> BJetTaggingAdjustRanges: Adjusting ranges of d0, z0 and d0Sig, z0Sig"
32  << std::endl;
33  }
34  f->cd("/");
35  // get run directory name
36  TIter nextcd0(gDirectory->GetListOfKeys());
37  TKey* key0 = (TKey*) nextcd0();
38  TDirectory* dir0 = dynamic_cast<TDirectory*> (key0->ReadObj());
39 
40  if (dir0 != 0) {
41  dir0->cd();
42 
43  TIter next_run(f->GetListOfKeys());
44  TKey* key_run(0);
45 
46  // loop through runs in the file
47  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
48  if (debugLevel > 1) {
49  std::cout << "--> BJetTaggingAdjustRanges: Getting run " << key_run << std::endl;
50  }
51  TObject* obj_run = key_run->ReadObj();
52  TDirectory* tdir_run = dynamic_cast<TDirectory*> (obj_run);
53 
54  // Some checks of the run number
55  if (tdir_run != 0) {
56  //if (debugLevel > 0) {
57  // std::cerr << "--> BJetTaggingAdjustRanges: directory " << tdir_run
58  // << " not found." << std::endl;
59  //}
60  //continue;
61  //delete obj_run;
62 
63  TString run_dir = tdir_run->GetName();
64  if (!run_dir.Contains("run")) {
65  std::cerr << "--> BJetTaggingAdjustRanges: no run found" << std::endl;
66  return;
67  //delete obj_run;
68  }
69 
70  if (debugLevel > 1) {
71  std::cout << "--> BJetTaggingAdjustRanges: Getting run no. " << run_dir
72  << std::endl;
73  }
74 
75  // Setting the branch for the impact parameters
76  TString jetmon_dir = run_dir + "/JetTagging";
77 
78  TDirectory* dir(0);
79  //std::cout << "--> BJetTaggingAdjustRanges: directory " << diag_dir
80  // << std::endl;
81 
82  if (!(dir = f->GetDirectory(jetmon_dir))) {
83  if (debugLevel > 0) std::cerr << "--> BJetTaggingAdjustRanges: directory " << jetmon_dir
84  << " not found." << std::endl;
85  return;
86  }
87  // std::cout << "--> BJetTaggingAdjustRanges: Setting d0,z0,d0Sig,z0Sig vectors" << std::endl;
88  std::vector < TString > impactParameters;
89  impactParameters.push_back("d0Sig");
90  impactParameters.push_back("z0Sig");
91 
92  impactParameters.push_back("d0");
93  impactParameters.push_back("z0");
94 
95  std::vector < TString > etaAndPtRanges;
96  etaAndPtRanges.push_back("_EtaRange_0_PtRange_0");
97  etaAndPtRanges.push_back("_EtaRange_0_PtRange_1");
98  etaAndPtRanges.push_back("_EtaRange_0_PtRange_2");
99  etaAndPtRanges.push_back("_EtaRange_1_PtRange_0");
100  etaAndPtRanges.push_back("_EtaRange_1_PtRange_1");
101  etaAndPtRanges.push_back("_EtaRange_1_PtRange_2");
102  etaAndPtRanges.push_back("_EtaRange_2_PtRange_0");
103  etaAndPtRanges.push_back("_EtaRange_2_PtRange_1");
104  etaAndPtRanges.push_back("_EtaRange_2_PtRange_2");
105  etaAndPtRanges.push_back("_EtaRange_3_PtRange_0");
106  etaAndPtRanges.push_back("_EtaRange_3_PtRange_1");
107  etaAndPtRanges.push_back("_EtaRange_3_PtRange_2");
108  etaAndPtRanges.push_back("_EtaRange_4_PtRange_0");
109  etaAndPtRanges.push_back("_EtaRange_4_PtRange_1");
110  etaAndPtRanges.push_back("_EtaRange_4_PtRange_2");
111 
112  TH1F* workingHistogram(0);
113 
114  TString impactParameterHistos, workingHistogramName;
115 
116  for (std::vector<TString>::iterator itT = impactParameters.begin(); itT
117  != impactParameters.end(); ++itT) {
118  for (std::vector<TString>::iterator itO = etaAndPtRanges.begin(); itO
119  != etaAndPtRanges.end(); ++itO) {
120  workingHistogramName = (*itT) + (*itO);
121  impactParameterHistos = jetmon_dir + "/" + workingHistogramName;
122 
123  workingHistogram = dynamic_cast<TH1F*> (f->Get(impactParameterHistos));
124  if (workingHistogram != 0) {
125  if (debugLevel > 1) {
126  //std::cout << "--> BJetTaggingAdjustRanges: Really doing this stuff" <<
127  // workingHistogramName<<std::endl;
128  }
129 
130  /*
131  * Here the bins are initialised and the upper and lower end from the histogram data
132  * are used as new borders of the updated histogram.
133  * */
134 
135  int minimalBin = 0;
136  int maximalBin = 0;
137 
138  minimalBin = workingHistogram->FindFirstBinAbove(0.0, 1);
139  maximalBin = workingHistogram->FindLastBinAbove(0.0, 1);
140 
141  workingHistogram->SetAxisRange(TMath::Max(1, (minimalBin - 5)),
142  (maximalBin + 5), "X");
143 
144  dir->cd();
145  workingHistogram->Write("", TObject::kOverwrite);
146  } else {
147  if (debugLevel > 0) {
148  std::cerr << "Histogram " << impactParameterHistos << " not found."
149  << std::endl;
150  }
151  }
152  } // for eta/Pt range
153  } // for TrigItems
154  if (debugLevel > 1) {
155  std::cout << "--> BJetTaggingAdjustRanges: Finished" << std::endl;
156  }
157  }
158  } // if tdir_run!=0
159  }//while
160  }//MonitoringFile::BJetTaggingAdjustRanges

◆ BJetTaggingNormalise()

void dqutils::MonitoringFile::BJetTaggingNormalise ( TFile *  f)
static

Definition at line 25 of file MonitoringFile_BJetTaggingNormalise.cxx.

25  {
27 
28  if (debugLevel > 1) {
29  std::cout << "--> BJetTaggingNormalise: Adjusting ranges of d0, z0 and d0Sig, z0Sig"
30  << std::endl;
31  }
32 
33  f->cd("/");
34  // get run directory name
35  TIter nextcd0(gDirectory->GetListOfKeys());
36  TKey* key0 = (TKey*) nextcd0();
37 
38  TDirectory* dir0 = dynamic_cast<TDirectory*> (key0->ReadObj());
39  if (dir0 != 0) {
40  dir0->cd();
41 
42  TIter next_run(f->GetListOfKeys());
43  TKey* key_run(0);
44 
45  // loop through the runs
46  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
47  if (debugLevel > 1) {
48  std::cout << "--> BJetTaggingNormalise: Getting run " << key_run << std::endl;
49  }
50  TObject* obj_run = key_run->ReadObj();
51  TDirectory* tdir_run = dynamic_cast<TDirectory*> (obj_run);
52 
53  // Some checks of the run number
54  if (tdir_run != 0) {
55  //std::cerr << "--> BJetTaggingNormalise: directory " << tdir_run << " not found."
56  // << std::endl;
57  //return;
58  //}
59 
60  TString run_dir = tdir_run->GetName();
61  if (!run_dir.Contains("run")) {
62  std::cerr << "--> BJetTaggingNormalise: no run found" << std::endl;
63  return;
64  }
65  if (debugLevel > 1) {
66  std::cout << "--> BJetTaggingNormalise: Getting run no. " << run_dir << std::endl;
67  }
68 
69  // Setting the branch for JetTagging
70  TString diag_dir = run_dir + "/JetTagging";
71 
72  TDirectory* dir(0);
73  if (debugLevel > 1) {
74  std::cout << "--> BJetTaggingNormalise: directory " << diag_dir << std::endl;
75  }
76  if (!(dir = f->GetDirectory(diag_dir))) {
77  std::cerr << "--> BJetTaggingNormalise: directory " << diag_dir << " not found."
78  << std::endl;
79  return;
80  }
81  if (debugLevel > 1) {
82  std::cout << "--> BJetTaggingNormalise: Setting the to process histgrams"
83  << std::endl;
84  }
85 
86  // 2D histograms
87 
88  std::vector < TString > nomHistosNames;
89  std::vector < TString > denHistosNames;
90 
91  nomHistosNames.push_back("track_selector_eff");
92  nomHistosNames.push_back("track_selector_eff_LS"); // added by SARA
93  //nomHistosNames.push_back("jet_2D_kinematic"); // removed by SARA
94  nomHistosNames.push_back("ip3d_tag_def_rate_2D");
95  //nomHistosNames.push_back("ip2d_tag_pos_rate_2D");
96  nomHistosNames.push_back("ip3d_tag_neg_rate_2D");
97  nomHistosNames.push_back("ip3d_tag_pos_rate_2D");
98  //nomHistosNames.push_back("sv1_tag_neg_rate_2D");
99  //nomHistosNames.push_back("sv1_tag_pos_rate_2D");
100  //nomHistosNames.push_back("sv2_tag_neg_rate_2D");
101  //nomHistosNames.push_back("sv2_tag_pos_rate_2D");
102  nomHistosNames.push_back("tracks_pTMin_2D");
103  nomHistosNames.push_back("tracks_d0Max_2D");
104  nomHistosNames.push_back("tracks_z0Max_2D");
105  nomHistosNames.push_back("tracks_sigd0Max_2D");
106  nomHistosNames.push_back("tracks_sigz0Max_2D");
107  nomHistosNames.push_back("tracks_etaMax_2D");
108  nomHistosNames.push_back("tracks_nHitBLayer_2D");
109  nomHistosNames.push_back("tracks_deadBLayer_2D");
110  nomHistosNames.push_back("tracks_nHitPix_2D");
111  nomHistosNames.push_back("tracks_nHitSct_2D");
112  nomHistosNames.push_back("tracks_nHitSi_2D");
113  nomHistosNames.push_back("tracks_nHitTrt_2D");
114  nomHistosNames.push_back("tracks_nHitTrtHighE_2D");
115  nomHistosNames.push_back("tracks_fitChi2_2D");
116  nomHistosNames.push_back("tracks_fitProb_2D");
117  nomHistosNames.push_back("tracks_fitChi2OnNdfMax_2D");
118 
119  denHistosNames.push_back("track_selector_all");
120  denHistosNames.push_back("track_selector_all_LS"); // added by SARA
121  //denHistosNames.push_back("jet_2D_all"); // removed by SARA
122  denHistosNames.push_back("jet_2D_all");
123  denHistosNames.push_back("jet_2D_all");
124  denHistosNames.push_back("jet_2D_all");
125  //denHistosNames.push_back("track_selector_all");
126  //denHistosNames.push_back("track_selector_all");
127  //denHistosNames.push_back("track_selector_all");
128  //denHistosNames.push_back("track_selector_all");
129  //denHistosNames.push_back("track_selector_all");
130  //denHistosNames.push_back("track_selector_all");
131  //denHistosNames.push_back("track_selector_all");
132  //denHistosNames.push_back("track_selector_all");
133  denHistosNames.push_back("tracks_all_2D");
134  denHistosNames.push_back("tracks_all_2D");
135  denHistosNames.push_back("tracks_all_2D");
136  denHistosNames.push_back("tracks_all_2D");
137  denHistosNames.push_back("tracks_all_2D");
138  denHistosNames.push_back("tracks_all_2D");
139  denHistosNames.push_back("tracks_all_2D");
140  denHistosNames.push_back("tracks_all_2D");
141  denHistosNames.push_back("tracks_all_2D");
142  denHistosNames.push_back("tracks_all_2D");
143  denHistosNames.push_back("tracks_all_2D");
144  denHistosNames.push_back("tracks_all_2D");
145  denHistosNames.push_back("tracks_all_2D");
146  denHistosNames.push_back("tracks_all_2D");
147  denHistosNames.push_back("tracks_all_2D");
148  denHistosNames.push_back("tracks_all_2D");
149  //denHistosNames.push_back("tracks_all_2D"); // removed by SARA (was orphen)
150 
151  TH2F* workingHistogramNom(0);
152  TH2F* workingHistogramDen(0);
153 
154  TString nomHistos, workingHistogramNameNom;
155  TString denHistos, workingHistogramNameDen;
156 
157  for (unsigned int i = 0; i < nomHistosNames.size(); i++) {
158  workingHistogramNameNom = (nomHistosNames[i]);
159  workingHistogramNameDen = (denHistosNames[i]);
160  nomHistos = diag_dir + "/" + workingHistogramNameNom;
161  denHistos = diag_dir + "/" + workingHistogramNameDen;
162  //std::cout << "--> BJetTaggingNormalise: histogram " << nomHistos << std::endl;
163 
164 
165  // std::cout << "--> BJetTaggingNormalise: Doing the normalisation" << std::endl;
166  if (!f->Get(nomHistos)) {
167  if (debugLevel > 0) {
168  std::cerr << "--> BBJetTaggingNormalise: no such histogram " << nomHistos
169  << std::endl;
170  }
171  continue;
172  }
173  if (!f->Get(denHistos)) {
174  if (debugLevel > 0) {
175  std::cerr << "--> BJetTaggingNormalise: no such histogram " << denHistos
176  << std::endl;
177  }
178  continue;
179  }
180 
181  workingHistogramNom = dynamic_cast<TH2F*> (f->Get(nomHistos));
182  workingHistogramDen = dynamic_cast<TH2F*> (f->Get(denHistos));
183 
184  if (workingHistogramNom == 0 || workingHistogramDen == 0) {
185  continue;
186  }
187 
188  /*
189  * Here the bins are initialised and the upper and lower end from the histogram data
190  * are used as new borders of the updated histogram.
191  * */
192 
193  {
194  if (debugLevel > 1) {
195  std::cout << nomHistos << "/" << denHistos << " integral before "
196  << workingHistogramNom->Integral() << std::endl;
197  }
198  workingHistogramNom->Divide(workingHistogramDen);
199 
200  if (debugLevel > 1) {
201  std::cout << "integral after " << workingHistogramNom->Integral() << std::endl;
202  }
203  }
204  dir->cd();
205  workingHistogramNom->Write("", TObject::kOverwrite);
206 
207  // for eta/Pt range
208  } // end loop over 2D histograms
209 
210  // 1D histograms
211 
212  std::vector < TString > nom1DHistosNames; // added by SARA
213  std::vector < TString > den1DHistosNames; // added by SARA
214  std::vector < TString > eff1DHistosNames; // added by SARA
215 
216  nom1DHistosNames.push_back("jet_top_tagged"); // added by SARA
217  nom1DHistosNames.push_back("jet_pt_top_tagged"); // added by SARA
218  nom1DHistosNames.push_back("tag_MV_w_phi_sum60OP"); // added by SARA
219  nom1DHistosNames.push_back("tag_MV_w_phi_sum70OP"); // added by SARA
220  nom1DHistosNames.push_back("tag_MV_w_phi_sum77OP"); // added by SARA
221  nom1DHistosNames.push_back("tag_MV_w_phi_sum85OP"); // added by SARA
222  nom1DHistosNames.push_back("tag_MV_w_eta_sum60OP"); // added by SARA
223  nom1DHistosNames.push_back("tag_MV_w_eta_sum70OP"); // added by SARA
224  nom1DHistosNames.push_back("tag_MV_w_eta_sum77OP"); // added by SARA
225  nom1DHistosNames.push_back("tag_MV_w_eta_sum85OP"); // added by SARA
226  nom1DHistosNames.push_back("tag_MV_w_sj_phi_sum60OP"); // added by SARA
227  nom1DHistosNames.push_back("tag_MV_w_sj_phi_sum70OP"); // added by SARA
228  nom1DHistosNames.push_back("tag_MV_w_sj_phi_sum77OP"); // added by SARA
229  nom1DHistosNames.push_back("tag_MV_w_sj_phi_sum85OP"); // added by SARA
230  nom1DHistosNames.push_back("tag_MV_w_sj_eta_sum60OP"); // added by SARA
231  nom1DHistosNames.push_back("tag_MV_w_sj_eta_sum70OP"); // added by SARA
232  nom1DHistosNames.push_back("tag_MV_w_sj_eta_sum77OP"); // added by SARA
233  nom1DHistosNames.push_back("tag_MV_w_sj_eta_sum85OP"); // added by SARA
234 
235  den1DHistosNames.push_back("jet_top"); // added by SARA
236  den1DHistosNames.push_back("jet_pt_top"); // added by SARA
237  den1DHistosNames.push_back("tag_MV_w_phi_sumAll"); // added by SARA
238  den1DHistosNames.push_back("tag_MV_w_phi_sumAll"); // added by SARA
239  den1DHistosNames.push_back("tag_MV_w_phi_sumAll"); // added by SARA
240  den1DHistosNames.push_back("tag_MV_w_phi_sumAll"); // added by SARA
241  den1DHistosNames.push_back("tag_MV_w_eta_sumAll"); // added by SARA
242  den1DHistosNames.push_back("tag_MV_w_eta_sumAll"); // added by SARA
243  den1DHistosNames.push_back("tag_MV_w_eta_sumAll"); // added by SARA
244  den1DHistosNames.push_back("tag_MV_w_eta_sumAll"); // added by SARA
245  den1DHistosNames.push_back("tag_MV_w_sj_phi_sumAll"); // added by SARA
246  den1DHistosNames.push_back("tag_MV_w_sj_phi_sumAll"); // added by SARA
247  den1DHistosNames.push_back("tag_MV_w_sj_phi_sumAll"); // added by SARA
248  den1DHistosNames.push_back("tag_MV_w_sj_phi_sumAll"); // added by SARA
249  den1DHistosNames.push_back("tag_MV_w_sj_eta_sumAll"); // added by SARA
250  den1DHistosNames.push_back("tag_MV_w_sj_eta_sumAll"); // added by SARA
251  den1DHistosNames.push_back("tag_MV_w_sj_eta_sumAll"); // added by SARA
252  den1DHistosNames.push_back("tag_MV_w_sj_eta_sumAll"); // added by SARA
253 
254  eff1DHistosNames.push_back("jet_top_eff"); // added by SARA
255  eff1DHistosNames.push_back("jet_pt_top_eff"); // added by SARA
256  eff1DHistosNames.push_back("tag_MV_w_phi_frac60OP"); // added by SARA
257  eff1DHistosNames.push_back("tag_MV_w_phi_frac70OP"); // added by SARA
258  eff1DHistosNames.push_back("tag_MV_w_phi_frac77OP"); // added by SARA
259  eff1DHistosNames.push_back("tag_MV_w_phi_frac85OP"); // added by SARA
260  eff1DHistosNames.push_back("tag_MV_w_eta_frac60OP"); // added by SARA
261  eff1DHistosNames.push_back("tag_MV_w_eta_frac70OP"); // added by SARA
262  eff1DHistosNames.push_back("tag_MV_w_eta_frac77OP"); // added by SARA
263  eff1DHistosNames.push_back("tag_MV_w_eta_frac85OP"); // added by SARA
264  eff1DHistosNames.push_back("tag_MV_w_sj_phi_frac60OP"); // added by SARA
265  eff1DHistosNames.push_back("tag_MV_w_sj_phi_frac70OP"); // added by SARA
266  eff1DHistosNames.push_back("tag_MV_w_sj_phi_frac77OP"); // added by SARA
267  eff1DHistosNames.push_back("tag_MV_w_sj_phi_frac85OP"); // added by SARA
268  eff1DHistosNames.push_back("tag_MV_w_sj_eta_frac60OP"); // added by SARA
269  eff1DHistosNames.push_back("tag_MV_w_sj_eta_frac70OP"); // added by SARA
270  eff1DHistosNames.push_back("tag_MV_w_sj_eta_frac77OP"); // added by SARA
271  eff1DHistosNames.push_back("tag_MV_w_sj_eta_frac85OP"); // added by SARA
272 
273  TH1F* working1DHistogramNom(0);
274  TH1F* working1DHistogramDen(0);
275  TH1F* working1DHistogramEff(0);
276 
277  TString nom1DHistos, working1DHistogramNameNom;
278  TString den1DHistos, working1DHistogramNameDen;
279  TString eff1DHistos, working1DHistogramNameEff;
280 
281  for (unsigned int i = 0; i < nom1DHistosNames.size(); i++) {
282  working1DHistogramNameNom = (nom1DHistosNames[i]);
283  working1DHistogramNameDen = (den1DHistosNames[i]);
284  working1DHistogramNameEff = (eff1DHistosNames[i]);
285  nom1DHistos = diag_dir + "/" + working1DHistogramNameNom;
286  den1DHistos = diag_dir + "/" + working1DHistogramNameDen;
287  eff1DHistos = diag_dir + "/" + working1DHistogramNameEff;
288  //std::cout << "--> BJetTaggingNormalise: 1D histogram " << nom1DHistos << std::endl;
289 
290 
291  // std::cout << "--> BJetTaggingNormalise: Doing the 1D normalisation" << std::endl;
292  if (!f->Get(nom1DHistos)) {
293  if (debugLevel > 0) {
294  std::cerr << "--> BBJetTaggingNormalise: no such 1D histogram " << nom1DHistos
295  << std::endl;
296  }
297  continue;
298  }
299  if (!f->Get(den1DHistos)) {
300  if (debugLevel > 0) {
301  std::cerr << "--> BJetTaggingNormalise: no such 1D histogram " << den1DHistos
302  << std::endl;
303  }
304  continue;
305  }
306  if (!f->Get(eff1DHistos)) {
307  if (debugLevel > 0) {
308  std::cerr << "--> BJetTaggingNormalise: no such 1D histogram " << eff1DHistos
309  << std::endl;
310  }
311  continue;
312  }
313 
314  working1DHistogramNom = dynamic_cast<TH1F*> (f->Get(nom1DHistos));
315  working1DHistogramDen = dynamic_cast<TH1F*> (f->Get(den1DHistos));
316  working1DHistogramEff = dynamic_cast<TH1F*> (f->Get(eff1DHistos));
317  //if xomething goes wrong, do nothing and loop around
318  if (!working1DHistogramNom or !working1DHistogramDen or !working1DHistogramEff) {
319  continue;
320  }
321 
322  /*
323  * Here the bins are initialised and the upper and lower end from the histogram data
324  * are used as new borders of the updated histogram.
325  * */
326 
327  {
328  if (debugLevel > 1) {
329  std::cout << nom1DHistos << "/" << den1DHistos << " integral before "
330  << working1DHistogramNom->Integral() << std::endl;
331  }
332  working1DHistogramEff->Divide(working1DHistogramNom, working1DHistogramDen, 1., 1., "B");
333 
334  if (debugLevel > 1) {
335  std::cout << "integral after " << working1DHistogramEff->Integral() << std::endl;
336  }
337  }
338  dir->cd();
339  working1DHistogramEff->Write("", TObject::kOverwrite);
340 
341  // for eta/Pt range
342  } // end loop over 1D histograms
343 
344  if (debugLevel > 1) {
345  std::cout << "--> BJetTaggingNormalise: Finished" << std::endl;
346  }
347  }//tdir_run != 0
348  }//while
349  }//MonitoringFile::BJetTaggingNormalise
350  }

◆ BJetTaggingPostProcess()

void dqutils::MonitoringFile::BJetTaggingPostProcess ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 39 of file MonitoringFile_BJetTaggingPostProcess.cxx.

39  {
40  if (isIncremental == true) {
41  return;
42  }
43 
45  if (debugLevel > 1) {
46  std::cout << "--> JetTaggingPostProcess: Begin JetTagging post-processing" << std::endl;
47  }
48  //open root file
49  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
50 
51  //check files are loaded.
52  if (f == 0 || !f->IsOpen()) {
53  std::cerr << "--> BJetTaggingPostProcess: Input file not opened" << std::endl;
54  return;
55  }
56 
57  if (f->IsZombie()) {
58  std::cerr << "--> BJetTaggingPostProcess: Input file " << inFilename
59  << " cannot be opened. " << std::endl;
60  return;
61  }
62 
63  //check file size is not too small.
64  if (f->GetSize() < 1000.) {
65  std::cerr << "--> BJetTaggingPostProcess: Input file empty" << std::endl;
66  f->Close();
67  return;
68  }
69 
70  //start postprocessing
71 
72  //here impact parameter histograms get a range in which they are actually filled
74 
75  //this will normalise some 2D histograms to the track/jet number
77 
78  //close root file
79  f->Close();
80  //delete f;
81 
82  if (debugLevel > 1) {
83  std::cout << "--> BJetTaggingPostProcess: End JetTagging post-processing " << std::endl;
84  }
85  return;
86  }

◆ buildLBToIntervalMap()

static void dqutils::MonitoringFile::buildLBToIntervalMap ( std::vector< TDirectory * > &  ,
std::vector< TDirectory * > &  ,
map_dir_vdir ,
debugLevel_t  
)
staticprivate

◆ CheckHistogram()

static bool dqutils::MonitoringFile::CheckHistogram ( TFile *  f,
const char *  HistoName 
)
static

◆ clearData()

virtual void dqutils::MonitoringFile::clearData ( )
protectedvirtual

◆ combineHistos()

TH1F * dqutils::MonitoringFile::combineHistos ( const char *  name,
const char *  title,
TObjArray *  plots,
int  gap 
)
static

Definition at line 3616 of file MonitoringFile_IDAlignPostProcess.cxx.

3617  {
3618  //makes one histogram out of all the histograms in the TObjArray
3619  //this histogram is built such that the histograms are placed side-by-side
3620  //on the same x-axis
3621 
3622  int n_plots = (plots->GetLast()) + 1;//add one since begins at zero
3623 
3624  //std::cout << "nplots = " << n_plots << std::endl;
3625 
3626  //count total bins
3627  int totalBins = 0;
3628 
3629  for (int i = 0; i != n_plots; ++i) {
3630  int nbins = ((TH1F*) (plots->At(i)))->GetNbinsX();
3631  totalBins = totalBins + nbins;
3632  }
3633  //take account of the gap we want to leave between plots
3634  totalBins = totalBins + ((n_plots - 1) * gap);
3635 
3636  TH1F* hnew = new TH1F(name, title, totalBins, 0, totalBins);
3637 
3638  int bCount = 1;
3639  //loop over the plots and fill the new one
3640  for (int i = 0; i != n_plots; ++i) {
3641  TH1F* h = (TH1F*) (plots->At(i));
3642 
3643  int nbins_h = h->GetNbinsX();
3644  //fill the bins with the content of h
3645  for (int j = 1; j != nbins_h + 1; ++j) {
3646  hnew->SetBinContent(bCount, h->GetBinContent(j));
3647  hnew->SetBinError(bCount, h->GetBinError(j));
3648  bCount++;
3649  }
3650 
3651  //skip the next bins to produce a gap
3652  //only if this isn't the last plot
3653  //(don't want a gap at the end)
3654  if (i < (n_plots - 1)) bCount = bCount + gap;
3655  }
3656 
3657  return hnew;
3658  }

◆ ComputeUPXBinErrors()

int dqutils::MonitoringFile::ComputeUPXBinErrors ( TH1F *  hnum,
TH1F *  hden,
std::vector< float > &  errors 
)
static

Definition at line 206 of file MonitoringFile_HLTJetCalcEfficiencyAndRate.cxx.

206  {
207  if (hnum == 0 || hden == 0) return -1;
208 
209  Int_t nbins_num = hnum->GetNbinsX();
210  Int_t nbins_den = hden->GetNbinsX();
211 
212  if (nbins_num != nbins_den) return -2;
213 
214  if (hden->GetEntries() == 0) return -3;
215 
216  errors.clear();
217  for (Int_t i = -1; i <= nbins_num; ++i) { // NB: loop includes under- & overflow
218  float n = hden->GetBinContent(i);
219  if (n == 0) continue;
220  float k = hnum->GetBinContent(i);
221  if (k < 0 || n < 0) {
222  if (MonitoringFile::getDebugLevel() > 0) std::cerr << "--> ComputeUPXBinErrors : ERROR: found negative entries in bin " << i
223  << " for histograms " << hnum->GetName() << " , " << hden->GetName() << std::endl;
224  break;
225  }
226  float num1 = (k + 1) * (k + 2);
227  float den1 = (n + 2) * (n + 3);
228  float num2 = (k + 1) * (k + 1);
229  float den2 = (n + 2) * (n + 2);
230  float variance = num1 / den1 - num2 / den2;
231  float err = sqrt(variance);
232  errors.push_back(err);
233  }
234  Int_t num_err = (Int_t) errors.size();
235  int retval = 1;
236  if (num_err != nbins_num) retval = -4;
237  return retval;
238  }

◆ copyHistograms()

virtual bool dqutils::MonitoringFile::copyHistograms ( const std::string &  outFileName,
const std::string &  dirName = "all" 
)
virtual

Copy the indicated set of histograms to an output file.

◆ createDir()

static TDirectory* dqutils::MonitoringFile::createDir ( DirMap_t dirmap,
TDirectory *  dir,
const std::string &  parent,
const std::string &  path 
)
static

◆ dirHasHistogramsInMetadata()

static bool dqutils::MonitoringFile::dirHasHistogramsInMetadata ( TDirectory *  dir)
staticprotected

◆ doTiming()

void dqutils::MonitoringFile::doTiming ( )

◆ fillDetPaperMeanRMS()

void dqutils::MonitoringFile::fillDetPaperMeanRMS ( TH2F *  h2d,
TH1F *  h,
int  iopt 
)
static

Definition at line 3873 of file MonitoringFile_IDAlignPostProcess.cxx.

3874  {
3875  //this finds the statistical mean/rms using the detector paper definition
3876  //i.e. the mean and RMS defined using bins which contain 99.7% of entries (symmetrically) around the mean bin
3877  // iopt=0; Mean
3878  // iopt=1; RMS (resolution)
3879  //Note that this method is not reliable if there is large underflow/overflow in the histogram.
3880 
3881  //calling this means that the histogram bin content is flagged
3882  //as being an average and so adding histos from different jobs
3883  //will produce weighted mean
3884  h->SetBit(TH1::kIsAverage);
3885 
3886  int nbins_2d = h2d->GetNbinsX();
3887 
3888  // Removed by Alex
3889  //int nbins_h = h->GetNbinsX();
3890  //if(nbins_2d!=nbins_h) std::cout << "Mean/Width Histograms not set up correctly - nbins mismatch for " <<
3891  // h->GetName() << std::endl;
3892 
3893  for (int i = 1; i != nbins_2d + 1; i++) {
3894  //std::cout << "fillDetPaperMeanRMS: processing bin " << i << std::endl;
3895 
3896  TH1F* hproj = (TH1F*) h2d->ProjectionY("proj", i, i, "e");
3897 
3898  //std::cout << "fillDetPaperMeanRMS: made projection for bin " << i << std::endl;
3899 
3900  //do not fill if there are few entries in the bin
3901  if (hproj->GetEntries() <= 30 || hproj->Integral() <= 30) {
3902  delete hproj;
3903  continue;
3904  }
3905 
3906  float hmean = hproj->GetMean();
3907  // float hRMS = hproj->GetRMS();
3908  float hFullIntegral = hproj->Integral(1, hproj->GetNbinsX());
3909 
3910  //std::cout << "fillDetPaperMeanRMS: Original Mean, RMS = " << hmean << ", " << hRMS << std::endl;
3911 
3912  float hTargetIntegral = 0.997 * hFullIntegral;
3913  int hMeanBin = hproj->FindBin(hmean);
3914 
3915  //std::cout << "fillDetPaperMeanRMS: NEntries = " << hproj->GetEntries() << ", fullIntegral = " << hFullIntegral
3916  // << std::endl;
3917 
3918  int lowBin = hMeanBin;
3919  int highBin = hMeanBin;
3920  float hIntegral = 0.0;
3921 
3922  while (hIntegral < hTargetIntegral) {
3923  // find the bin which contains the mean
3924  // then integrate symmetrically around this bin, increasing the range
3925  // until the integral is larger than the target
3926  // this defines your upper and lower bounds for mean/rms.
3927 
3928  lowBin = lowBin - 1;
3929  highBin = highBin + 1;
3930  hIntegral = hproj->Integral(lowBin, highBin);
3931  }
3932 
3933  //std::cout << "fillDetPaperMeanRMS: NBins = " << hproj->GetNbinsX() << " minBin = " << lowBin << " highBin = "
3934  // << highBin << std::endl;
3935 
3936  TH1F* hclone = (TH1F*) hproj->Clone("clone");
3937 
3938  hclone->GetXaxis()->SetRange(lowBin, highBin);
3939  float hNewMean = hclone->GetMean();
3940  float hNewMeanErr = hclone->GetMeanError();
3941  float hNewRMS = hclone->GetRMS();
3942  float hNewRMSErr = hclone->GetRMSError();
3943 
3944  //std::cout << "fillDetPaperMeanRMS: New Mean, RMS = " << hNewMean << ", " << hNewRMS << std::endl;
3945 
3946  if (iopt == 0) {
3947  h->SetBinContent(i, hNewMean);
3948  h->SetBinError(i, hNewMeanErr);
3949  } else if (iopt == 1) {
3950  h->SetBinContent(i, hNewRMS);
3951  h->SetBinError(i, hNewRMSErr);
3952  }
3953  //else std::cout << "Incorrect switch in fillDetPaperMeanRMS" << std::endl;
3954 
3955  delete hproj;
3956  delete hclone;
3957  }
3958 
3959  return;
3960  }

◆ fillGaussianMeanOrWidth()

void dqutils::MonitoringFile::fillGaussianMeanOrWidth ( TH2F *  h2d,
TH1F *  h,
float  fitMin,
float  fitMax,
int  iopt 
)
static

Definition at line 3749 of file MonitoringFile_IDAlignPostProcess.cxx.

3750  {
3751  //Makes a Gaussian fit to each bin of a TH2F and fills a TH1F with
3752  //the either the mean or width of this Gaussian
3753  // iopt=0; Mean
3754  // iopt=1; Width
3755 
3756  //std::cout << "In fillGaussianMeanOrWidth for " << h->GetName() << std::endl;
3757 
3758  //calling this means that the histogram bin content is flagged
3759  //as being an average and so adding histos from different jobs
3760  //will produce weighted mean
3761  h->SetBit(TH1::kIsAverage);
3762 
3763  int nbins_2d = h2d->GetNbinsX();
3764 
3765  // Removed by Alex
3766  //int nbins_h = h->GetNbinsX();
3767  //if(nbins_2d!=nbins_h) std::cout << "Mean/Width Histograms not set up correctly - nbins mismatch for " <<
3768  // h->GetName() << std::endl;
3769 
3770  for (int i = 1; i != nbins_2d + 1; i++) {
3771  //std::cout << "Gaussian: processing bin " << i << std::endl;
3772 
3773  TH1F* hproj = (TH1F*) h2d->ProjectionY("proj", i, i, "e");
3774 
3775  //std::cout << "Gaussian: made projection for bin " << i << std::endl;
3776 
3777  //do not fill if there are few entries in the bin
3778  if (hproj->GetEntries() <= 30 || hproj->Integral() <= 30) {
3779  delete hproj;
3780  continue;
3781  }
3782 
3783  TF1* fit = new TF1("fit", "gaus", fitMin, fitMax);
3784 
3785  hproj->Fit("fit", "RQN");
3786  float mean = fit->GetParameter(1);
3787  float meanErr = fit->GetParError(1);
3788  float width = fit->GetParameter(2);
3789  float widthErr = fit->GetParError(2);
3790 
3791  //std::cout << "Gaussian: fitted bin " << i << std::endl;
3792 
3793  if (iopt == 0) {
3794  h->SetBinContent(i, mean);
3795  h->SetBinError(i, meanErr);
3796  } else if (iopt == 1) {
3797  h->SetBinContent(i, width);
3798  h->SetBinError(i, widthErr);
3799  }
3800  //else std::cout << "Incorrect switch in fillGaussianMeanOrWidth" << std::endl;
3801 
3802  delete hproj;
3803  delete fit;
3804  }
3805 
3806  //std::cout << "leaving fillGaussianMeanOrWidth for " << h->GetName() << std::endl;
3807 
3808  return;
3809  }

◆ fillMeanOrWidth()

void dqutils::MonitoringFile::fillMeanOrWidth ( TH2F *  h2d,
TH1F *  h,
int  iopt 
)
static

Definition at line 3702 of file MonitoringFile_IDAlignPostProcess.cxx.

3703  {
3704  //fills a 1-D histogram with either the mean or RMS of the 2d histogram in each bin.
3705  //binning of 1d and 2d histograms must match
3706  // iopt=0; Mean
3707  // iopt=1; Width
3708 
3709  //std::cout << "In fillMeanOrWidth" << std::endl;
3710 
3711  int nbins_2d = h2d->GetNbinsX();
3712  int nbins_h = h->GetNbinsX();
3713 
3714  if (nbins_2d != nbins_h) //std::cout << "Mean/RMS Histograms not set up correctly - nbins mismatch for " <<
3715  // h->GetName() << std::endl;
3716 
3717  for (int i = 1; i != nbins_2d + 1; i++) {
3718  //std::cout << "Processing bin " << i << std::endl;
3719 
3720  TH1F* hproj = (TH1F*) h2d->ProjectionY("proj", i, i, "e");
3721 
3722  //std::cout << "Made projection for bin " << i << std::endl;
3723 
3724  //do not fill if there are no entries in the bin
3725  if (hproj->GetEntries() <= 0) {
3726  delete hproj;
3727  continue;
3728  }
3729 
3730  if (iopt == 0) {
3731  h->SetBinContent(i, hproj->GetMean());
3732  h->SetBinError(i, hproj->GetMeanError());
3733  //std::cout << "Filled mean results for bin " << i << std::endl;
3734  } else if (iopt == 1) {
3735  h->SetBinContent(i, hproj->GetRMS());
3736  h->SetBinError(i, hproj->GetRMSError());
3737  }
3738  //else std::cout << "Incorrect switch in MeanRMSProjectionsBarrel()" << std::endl;
3739 
3740  delete hproj;
3741  }
3742 
3743  //std::cout << "Finished fillMeanOrWidth" << std::endl;
3744 
3745  return;
3746  }

◆ fillMetaDataMap()

static void dqutils::MonitoringFile::fillMetaDataMap ( std::map< std::string, dqutils::MonitoringFile::MetaData > &  mdMap,
TDirectory *  dir 
)
static

◆ FindCommon()

virtual std::string dqutils::MonitoringFile::FindCommon ( const std::string &  name1,
const std::string &  name2 
) const
virtual

◆ fitHistos()

void dqutils::MonitoringFile::fitHistos ( TH2F *  hin,
const std::vector< TH1F * > &  hout,
int  mode,
const std::string &  triggerName,
const std::string &  resonName,
TH1F *  m_chi2 
)
static

Definition at line 229 of file MonitoringFile_DiMuPostProcess.cxx.

230  {
231  bool saveHistos = false;
232 
233  // a canvas may be needed when implmenting this into the post-processing file
234  //std::cout<<"The fitHistos method is called"<<endl;
235  std::string hname = hin->GetName();
236  TCanvas* ctemp;
237  char num2str[50];
238  int nbins = hin->GetNbinsX();
239  for (int i = 0; i < nbins; i++) {
240  snprintf(num2str, 50, "%s_%i", (hname).c_str(), i);
241  TH1F* htemp = (TH1F*) (hin->ProjectionY(num2str, i + 1, i + 1));
242  //htemp->SetTitle(projName);
243  htemp->Sumw2();
244  if (htemp->GetEntries() > 50) {
245  double mean = 999., meanErr = 999., sigma = 999., sigmaErr = 999., chi2 = 0.;
246  if (resonName == "Jpsi" || resonName == "Upsi") {
247  mean = htemp->GetMean();
248  sigma = htemp->GetRMS();
249  TF1* fn = new TF1("fn", "gaus", mean - 2 * sigma, mean + 2 * sigma);
250  fn->SetParameters(htemp->GetEntries() / 4, mean, sigma);
251  htemp->Fit("fn", "RQMN");
252  mean = fn->GetParameter(1);
253  sigma = fn->GetParameter(2);
254  fn->SetRange(mean - 1.2 * sigma, mean + 1.2 * sigma);
255 
256  if (saveHistos == false) {
257  htemp->Fit("fn", "RQMN");
258  } else {
259  ctemp = new TCanvas("ctemp", "ctemp", 500, 500);
260  TString psName = num2str + triggerName + ".ps";
261  htemp->Fit("fn", "RQM");
262  ctemp->Print(psName);
263  delete ctemp;
264  }
265  double frange = 2.4 * sigma;
266  double hrange = htemp->GetXaxis()->GetXmax() - htemp->GetXaxis()->GetXmin();
267  double ndf = frange / hrange * (htemp->GetNbinsX()) - 3;//subtract number of fit parameters
268  //fill results ;
269  mean = fn->GetParameter(1);
270  meanErr = fn->GetParError(1);
271  sigma = fn->GetParameter(2);
272  sigmaErr = fn->GetParError(2);
273  chi2 = (fn->GetChisquare()) / ndf;
274  delete fn;
275  } else {
276  //fit Z peak with a convolution of BreitWigner and Crystal Ball fns, fit by Louise, implementation by Jike
277  // taken from IDPerfMon
278  RooMsgService::instance().setGlobalKillBelow(RooFit::FATAL);
279  RooAbsPdf::verboseEval(-100); //sami in order to make roofit quiet
280  RooRealVar m("mass", "dimuon invariable mass", 91.2, 71., 111., "GeV");
281  RooDataHist* data = 0;
282  data = new RooDataHist("data", "data", m, htemp);
283  RooRealVar bwm0("bw_#mu", "bw_#mu", 91.2, 85.2, 97.2);
284  RooRealVar bwsg("bw_#sigma", "bw_#sigma", 2.4952);
285  RooBreitWigner bw("bw", "bw", m, bwm0, bwsg);
286 
287  RooRealVar cbm0("cb_#mu", "cb_#mu", 0);
288  RooRealVar cbsg("cb_#sigma", "cb_#sigma", 3., 1., 10.);
289  RooRealVar cbal("cb_#alpha", "cb_#alpha", 2.0);
290  RooRealVar cbn("cb_n", "cb_n", 1., 0.05, 3.);
291  RooCBShape cb("cb", "cb", m, cbm0, cbsg, cbal, cbn);
292 
293  m.setBins(5000);
294  RooFFTConvPdf bxc("bxc", "BW (X) CB", m, bw, cb);
295  auto resourceToDelete = bxc.fitTo(*data, RooFit::PrintLevel(-1), RooFit::PrintEvalErrors(-1), RooFit::Warnings(kFALSE));
296  RooPlot* frame;
297  if (saveHistos == true) {
298  frame = m.frame();
299  data->plotOn(frame, RooFit::MarkerSize(0.9));
300  bxc.paramOn(frame, RooFit::Format("NELU", RooFit::AutoPrecision(2)), RooFit::Layout(0.1, 0.4, 0.9));
301  bxc.plotOn(frame, RooFit::LineColor(kBlue));
302  delete frame;
303  }
304  delete resourceToDelete;
305  mean = bwm0.getVal();
306  meanErr = bwm0.getError();
307  sigma = cbsg.getVal();
308  sigmaErr = cbsg.getError();
309  delete data;
310  }
311  //fill results
312  if (mode == 0) {//plot both invmass and width vs variable
313  hout.at(0)->SetBinContent(i + 1, mean);
314  hout.at(0)->SetBinError(i + 1, meanErr);
315  hout.at(1)->SetBinContent(i + 1, sigma);
316  hout.at(1)->SetBinError(i + 1, sigmaErr);
317  } else if (mode == 1) {//plot only invmass vs variable
318  hout.at(0)->SetBinContent(i + 1, mean);
319  hout.at(0)->SetBinError(i + 1, meanErr);
320  } else if (mode == 2) {//plot only width vs variable
321  hout.at(0)->SetBinContent(i + 1, sigma);
322  hout.at(0)->SetBinError(i + 1, sigmaErr);
323  }
324  h_chi2->Fill(chi2);
325  }// more than 50 events
326 
327  delete htemp;
328  }
329  }

◆ fitJpsiHistograms()

void dqutils::MonitoringFile::fitJpsiHistograms ( TH1F *  hmass,
TH1F *  hwidth,
TH1F *  h1[],
int  n 
)
static

Definition at line 2095 of file MonitoringFile_IDPerfPostProcess.cxx.

2096  {
2097  double jpsiPDGmass = 3.097;
2098  double mass = 0.;
2099  double mass_error = 0;
2100  double width = 0;
2101  double width_error = 0;
2102  double maxmass = 0.;
2103  double maxwidth = 0.;
2104  double minwidth = 999;
2105 
2106  hmass->SetMarkerStyle(21);
2107  hwidth->SetMarkerStyle(21);
2108 // TF1 *fitjpsi = new TF1("fitjpsi","gaus",2.9,3.3);
2109 // fitjpsi->SetParNames("Constant","Mean","Width");
2110  TF1* fitjpsi = new TF1("fitjpsi", "gaus", 2.6, 3.6);
2111  // fitjpsi->SetParNames("Constant","Mean","Sigma","Constant","Slope");
2112  fitjpsi->SetLineColor(2);
2113  for (int i = 0; i < n; i++) {
2114  int h1entries = h1[i]->GetEntries();
2115  if (h1entries > 50) {
2116  double mean = h1[i]->GetMean();
2117  double spread = 2 * (h1[i]->GetRMS());
2118  double constantGuess = double(h1entries) / 10.;
2119  fitjpsi->SetParameters(constantGuess, jpsiPDGmass, 0.05);
2120  fitjpsi->SetRange(mean - spread, mean + spread);
2121  h1[i]->Fit("fitjpsi", "RQM");
2122  mean = fitjpsi->GetParameter(1);
2123  spread = 1.2 * (fitjpsi->GetParameter(2));
2124  fitjpsi->SetRange(mean - spread, mean + spread);
2125  h1[i]->Fit("fitjpsi", "RQM");
2126  h1[i]->SetMarkerStyle(21);
2127  mass = fitjpsi->GetParameter(1) - jpsiPDGmass;
2128  mass_error = fitjpsi->GetParError(1);
2129  width = fitjpsi->GetParameter(2);
2130  width_error = fitjpsi->GetParError(2);
2131  hmass->SetBinContent(i + 1, mass);
2132  hmass->SetBinError(i + 1, mass_error);
2133  hwidth->SetBinContent(i + 1, width);
2134  hwidth->SetBinError(i + 1, width_error);
2135  if ((fabs(mass) + mass_error) > maxmass) maxmass = fabs(mass) + mass_error;
2136  if ((fabs(width) + width_error) > maxwidth) maxwidth = fabs(width) + width_error;
2137  if ((fabs(width) - width_error) < minwidth) minwidth = fabs(width) - width_error;
2138  }
2139  }
2140  if (maxmass > 0.1) maxmass = 0.1;
2141  if (maxwidth > 0.2) maxwidth = 0.2;
2142  if (minwidth < 0.) minwidth = 0.;
2143  hmass->SetAxisRange(-maxmass * 1.05, maxmass * 1.05, "Y");
2144 // hwidth->SetAxisRange(0.,maxwidth*1.05,"Y");
2145  if (minwidth < maxwidth) hwidth->SetAxisRange(minwidth * 0.9, maxwidth * 1.05, "Y");
2146 
2147  delete fitjpsi;
2148  }

◆ fitMergedFile_DiMuMonAll()

void dqutils::MonitoringFile::fitMergedFile_DiMuMonAll ( TFile *  f,
const std::string &  run_dir,
const std::string &  resonName,
const std::string &  triggerName 
)
static

Definition at line 133 of file MonitoringFile_DiMuPostProcess.cxx.

134  {
135  //std::cout<<"fitMergedFile_DiMuMon has been called"<<endl;
136  std::string path;
137  path = run_dir + "DiMuMon/" + resonName + "/" + triggerName;
138 
139  if (f->cd(path.c_str()) == 0) {
140  return;
141  }
142  std::vector<std::string> regions;
143  regions.push_back("All");
144  regions.push_back("BB");
145  regions.push_back("EAEA");
146  regions.push_back("ECEC");
147  std::vector<std::string> vars;
148  vars.push_back("eta");
149  vars.push_back("etaAll");
150  vars.push_back("etaPos");
151  vars.push_back("etaNeg");
152  vars.push_back("phi");
153  vars.push_back("phiAll");
154  vars.push_back("phiPos");
155  vars.push_back("phiNeg");
156  vars.push_back("pt");
157  vars.push_back("ptAll");
158  vars.push_back("ptPos");
159  vars.push_back("ptNeg");
160  vars.push_back("etaDiff");
161  vars.push_back("etaSumm");
162  vars.push_back("phiDiff");
163  vars.push_back("phiSumm");
164  vars.push_back("crtDiff");
165 
166  std::map< std::string, TH1F* > h_invmass;
167  std::map< std::string, std::map< std::string, TH2F*> > h_2DinvmassVSx;
168  std::map< std::string, std::map< std::string, TH1F*> > h_invmassVSx;
169  std::map< std::string, std::map< std::string, TH1F*> > h_widthVSx;
170  TH1F* h_chi2;
171 
172  //loop over all possible 2D histos
173  //check if 2D histo has been filled
174  //if found the 2D histo, then see whether the mean or width or both 1D histos were also made.-->Decide what to refit
175  // `
176  if (CheckHistogram(f, (path + "_detail/chi2").c_str())) {
177  h_chi2 = (TH1F*) (f->Get((path + "_detail/chi2").c_str())->Clone());
178  std::vector<std::string> ::iterator ivar = vars.begin();
179  std::vector<std::string> ::iterator ireg = regions.begin();
180  for (ireg = regions.begin(); ireg != regions.end(); ++ireg) {
181  for (ivar = vars.begin(); ivar != vars.end(); ++ivar) {
182  std::string hname2D = resonName + "_2DinvmassVS" + *ivar + "_" + *ireg;
183  if (CheckHistogram(f, (path + "/" + hname2D).c_str())) {
184  h_2DinvmassVSx[*ireg][*ivar] = (TH2F*) (f->Get((path + "/" + hname2D).c_str())->Clone());
185  std::string hnameMean = resonName + "_invmassVS" + *ivar + "_" + *ireg;
186  std::string hnameWidth = resonName + "_widthVS" + *ivar + "_" + *ireg;
187  std::vector<TH1F*> hfitted;
188  if (CheckHistogram(f, (path + "/" + hnameMean).c_str())) {
189  h_invmassVSx[*ireg][*ivar] = (TH1F*) (f->Get((path + "/" + hnameMean).c_str())->Clone());
190  hfitted.push_back(h_invmassVSx[*ireg][*ivar]);
191  if (CheckHistogram(f, (path + "_detail/" + hnameWidth).c_str())) {
192  h_widthVSx[*ireg][*ivar] = (TH1F*) (f->Get((path + "_detail/" + hnameWidth).c_str())->Clone());
193  hfitted.push_back(h_widthVSx[*ireg][*ivar]);
194  fitHistos(h_2DinvmassVSx[*ireg][*ivar], hfitted, 0, triggerName, resonName, h_chi2);// 0 means to fill
195  // both mean and
196  // width results
197  // from the fit
198  f->cd((path + "/").c_str());
199  h_invmassVSx[*ireg][*ivar]->Write("", TObject::kOverwrite);
200  f->cd((path + "_detail/").c_str());
201  h_widthVSx[*ireg][*ivar]->Write("", TObject::kOverwrite);
202  } else {
203  fitHistos(h_2DinvmassVSx[*ireg][*ivar], hfitted, 1, triggerName, resonName, h_chi2);// 1 means to fill
204  // only mean results
205  // from the fit
206  f->cd((path + "/").c_str());
207  h_invmassVSx[*ireg][*ivar]->Write("", TObject::kOverwrite);
208  }
209  } else {
210  if (CheckHistogram(f, (path + "_detail/" + hnameWidth).c_str())) {
211  h_widthVSx[*ireg][*ivar] = (TH1F*) (f->Get((path + "_detail/" + hnameWidth).c_str())->Clone());
212  hfitted.push_back(h_widthVSx[*ireg][*ivar]);
213  fitHistos(h_2DinvmassVSx[*ireg][*ivar], hfitted, 2, triggerName, resonName, h_chi2);// 2 means to fill
214  // only width
215  // results from the
216  // fit
217  f->cd((path + "_detail/").c_str());
218  h_widthVSx[*ireg][*ivar]->Write((path + "_detail/" + hnameWidth).c_str(), TObject::kOverwrite);
219  }
220  }
221  }
222  }
223  }
224  h_chi2->Write("", TObject::kOverwrite);
225  }
226  f->Write();
227  }

◆ fitMergedFile_DiMuMonManager()

void dqutils::MonitoringFile::fitMergedFile_DiMuMonManager ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 34 of file MonitoringFile_DiMuPostProcess.cxx.

35  { //adapted from
36  // MonitoringFile_IDPerfPostProcess.cxx
37  if (isIncremental == true) return;
38 
39  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
40  if (f == 0 || !f->IsOpen()) {
41  //std::cout<<"Failed to load or open file!"<<endl;
42  delete f;
43  return;
44  }
45  if (f->GetSize() < 1000.) {
46  //std::cout<<"File is empty!"<<endl;
47  delete f;
48  return;
49  }
50  std::string run_dir;
51  TIter next_run(f->GetListOfKeys());
52  TKey* key_run(0);
53  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
54  TObject* obj_run = key_run->ReadObj();
55  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
56  if (tdir_run != 0) {
57  std::string tdir_run_name(tdir_run->GetName());
58  if (tdir_run_name.find("run") != std::string::npos) {
59  run_dir = tdir_run_name;
60  TIter next_perf(tdir_run->GetListOfKeys());
61  TKey* key_perf(0);
62  while ((key_perf = dynamic_cast<TKey*>(next_perf())) != 0) {
63  std::string perf_name(key_perf->GetName());
64  if (perf_name.find("DiMuMon") != std::string::npos) {
65  TObject* obj_perf = key_perf->ReadObj();
66  TDirectory* tdir_perf = dynamic_cast<TDirectory*>(obj_perf);
67  if (tdir_perf != 0) {
68  run_dir = run_dir + '/';
69  TIter next_module(tdir_perf->GetListOfKeys());
70  TKey* key_module(0);
71  while ((key_module = dynamic_cast<TKey*>(next_module())) != 0) {
72  std::string module_name(key_module->GetName());
73  if (module_name.find("Jpsi") != std::string::npos) {
74  processModule(f, run_dir, key_module, "Jpsi");
75  } else if (module_name.find("Zmumu") != std::string::npos) {
76  processModule(f, run_dir, key_module, "Zmumu");
77  }
78  }
79  } else {
80  delete obj_perf;
81  }
82  }
83  }
84  }
85  // if without top run_directory
86  else if (tdir_run_name.find("DiMuMon") != std::string::npos) {
87  TObject* obj_perf = key_run->ReadObj();
88  TDirectory* tdir_perf = dynamic_cast<TDirectory*>(obj_perf);
89  if (tdir_perf != 0) {
90  run_dir = '/';
91  TIter next_module(tdir_perf->GetListOfKeys());
92  TKey* key_module(0);
93  while ((key_module = dynamic_cast<TKey*>(next_module())) != 0) {
94  std::string module_name(key_module->GetName());
95  if (module_name.find("Jpsi") != std::string::npos) {
96  processModule(f, run_dir, key_module, "Jpsi");
97  } else if (module_name.find("Zmumu") != std::string::npos) {
98  processModule(f, run_dir, key_module, "Zmumu");
99  }
100  }
101  } else {
102  delete obj_perf;
103  }
104  }
105  } else {
106  delete obj_run;
107  }
108  }
109 
110  f->Close();
111  delete f;
112  // if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "DiMuPostProcessing done!" <<endmsg;
113  }

◆ fitMergedFile_IDAlignMonGenericTracks()

void dqutils::MonitoringFile::fitMergedFile_IDAlignMonGenericTracks ( TFile *  file,
const std::string &  run_dir,
const std::string &  tracksName 
)
static

Definition at line 2307 of file MonitoringFile_IDAlignPostProcess.cxx.

2308  {
2309  std::string path;
2310  path = run_dir + "IDAlignMon/" + tracksName + "/GenericTracks";
2311  if (file->cd(path.c_str()) == 0) {
2312  //std::cerr << "MonitoringFile::fitMergedFile_IDAlignMonGenericTracks(): "
2313  // << "No such directory \"" << path << "\"\n";
2314  return;
2315  }
2316  //charge Asym vs pt
2317  if (CheckHistogram(file,
2318  (path + "/trk_pT_asym_barrel").c_str()) &&
2320  (path + "/trk_pT_neg_barrel").c_str()) &&
2321  CheckHistogram(file, (path + "/trk_pT_pos_barrel").c_str())) {
2322  TH1F* trk_pT_neg_barrel = (TH1F*) (file->Get((path + "/trk_pT_neg_barrel").c_str())->Clone());
2323  TH1F* trk_pT_pos_barrel = (TH1F*) (file->Get((path + "/trk_pT_pos_barrel").c_str())->Clone());
2324  TH1F* trk_pT_asym_barrel = (TH1F*) (file->Get((path + "/trk_pT_asym_barrel").c_str())->Clone());
2325  ProcessAsymHistograms(trk_pT_neg_barrel, trk_pT_pos_barrel, trk_pT_asym_barrel);
2326  trk_pT_asym_barrel->SetXTitle("p_{T} [GeV]");
2327  trk_pT_asym_barrel->Write("", TObject::kOverwrite);
2328  }
2329  if (CheckHistogram(file,
2330  (path + "/trk_pT_asym_ecc").c_str()) &&
2332  (path + "/trk_pT_neg_ecc").c_str()) &&
2333  CheckHistogram(file, (path + "/trk_pT_pos_ecc").c_str())) {
2334  TH1F* trk_pT_neg_ecc = (TH1F*) (file->Get((path + "/trk_pT_neg_ecc").c_str())->Clone());
2335  TH1F* trk_pT_pos_ecc = (TH1F*) (file->Get((path + "/trk_pT_pos_ecc").c_str())->Clone());
2336  TH1F* trk_pT_asym_ecc = (TH1F*) (file->Get((path + "/trk_pT_asym_ecc").c_str())->Clone());
2337  ProcessAsymHistograms(trk_pT_neg_ecc, trk_pT_pos_ecc, trk_pT_asym_ecc);
2338  trk_pT_asym_ecc->SetXTitle("p_{T} [GeV]");
2339  trk_pT_asym_ecc->Write("", TObject::kOverwrite);
2340  }
2341  if (CheckHistogram(file,
2342  (path + "/trk_pT_asym_eca").c_str()) &&
2344  (path + "/trk_pT_neg_eca").c_str()) &&
2345  CheckHistogram(file, (path + "/trk_pT_pos_eca").c_str())) {
2346  TH1F* trk_pT_neg_eca = (TH1F*) (file->Get((path + "/trk_pT_neg_eca").c_str())->Clone());
2347  TH1F* trk_pT_pos_eca = (TH1F*) (file->Get((path + "/trk_pT_pos_eca").c_str())->Clone());
2348  TH1F* trk_pT_asym_eca = (TH1F*) (file->Get((path + "/trk_pT_asym_eca").c_str())->Clone());
2349  ProcessAsymHistograms(trk_pT_neg_eca, trk_pT_pos_eca, trk_pT_asym_eca);
2350  trk_pT_asym_eca->SetXTitle("p_{T} [GeV]");
2351  trk_pT_asym_eca->Write("", TObject::kOverwrite);
2352  }
2353  if (CheckHistogram(file,
2354  (path + "/trk_pT_asym").c_str()) &&
2355  CheckHistogram(file, (path + "/pT_n").c_str()) && CheckHistogram(file, (path + "/pT_p").c_str())) {
2356  TH1F* trk_pT_neg = (TH1F*) (file->Get((path + "/pT_n").c_str())->Clone());
2357  TH1F* trk_pT_pos = (TH1F*) (file->Get((path + "/pT_p").c_str())->Clone());
2358  TH1F* trk_pT_asym = (TH1F*) (file->Get((path + "/trk_pT_asym").c_str())->Clone());
2359  ProcessAsymHistograms(trk_pT_neg, trk_pT_pos, trk_pT_asym);
2360  trk_pT_asym->SetXTitle("p_{T} [GeV]");
2361  trk_pT_asym->Write("", TObject::kOverwrite);
2362  }
2363 
2364  //charge Asym vs phi
2365  if (CheckHistogram(file,
2366  (path + "/trk_phi0_asym_barrel").c_str()) &&
2368  (path + "/trk_phi0_neg_barrel").c_str()) &&
2369  CheckHistogram(file, (path + "/trk_phi0_pos_barrel").c_str())) {
2370  TH1F* trk_phi0_neg_barrel = (TH1F*) (file->Get((path + "/trk_phi0_neg_barrel").c_str())->Clone());
2371  TH1F* trk_phi0_pos_barrel = (TH1F*) (file->Get((path + "/trk_phi0_pos_barrel").c_str())->Clone());
2372  TH1F* trk_phi0_asym_barrel = (TH1F*) (file->Get((path + "/trk_phi0_asym_barrel").c_str())->Clone());
2373  ProcessAsymHistograms(trk_phi0_neg_barrel, trk_phi0_pos_barrel, trk_phi0_asym_barrel);
2374  trk_phi0_asym_barrel->SetXTitle("track #phi [rad]");
2375  trk_phi0_asym_barrel->Write("", TObject::kOverwrite);
2376  }
2377  if (CheckHistogram(file,
2378  (path + "/trk_phi0_asym_ecc").c_str()) &&
2380  (path + "/trk_phi0_neg_ecc").c_str()) &&
2381  CheckHistogram(file, (path + "/trk_phi0_pos_ecc").c_str())) {
2382  TH1F* trk_phi0_neg_ecc = (TH1F*) (file->Get((path + "/trk_phi0_neg_ecc").c_str())->Clone());
2383  TH1F* trk_phi0_pos_ecc = (TH1F*) (file->Get((path + "/trk_phi0_pos_ecc").c_str())->Clone());
2384  TH1F* trk_phi0_asym_ecc = (TH1F*) (file->Get((path + "/trk_phi0_asym_ecc").c_str())->Clone());
2385  ProcessAsymHistograms(trk_phi0_neg_ecc, trk_phi0_pos_ecc, trk_phi0_asym_ecc);
2386  trk_phi0_asym_ecc->SetXTitle("track #phi [rad]");
2387  trk_phi0_asym_ecc->Write("", TObject::kOverwrite);
2388  }
2389  if (CheckHistogram(file,
2390  (path + "/trk_phi0_asym_eca").c_str()) &&
2392  (path + "/trk_phi0_neg_eca").c_str()) &&
2393  CheckHistogram(file, (path + "/trk_phi0_pos_eca").c_str())) {
2394  TH1F* trk_phi0_neg_eca = (TH1F*) (file->Get((path + "/trk_phi0_neg_eca").c_str())->Clone());
2395  TH1F* trk_phi0_pos_eca = (TH1F*) (file->Get((path + "/trk_phi0_pos_eca").c_str())->Clone());
2396  TH1F* trk_phi0_asym_eca = (TH1F*) (file->Get((path + "/trk_phi0_asym_eca").c_str())->Clone());
2397  ProcessAsymHistograms(trk_phi0_neg_eca, trk_phi0_pos_eca, trk_phi0_asym_eca);
2398  trk_phi0_asym_eca->SetXTitle("track #phi [rad]");
2399  trk_phi0_asym_eca->Write("", TObject::kOverwrite);
2400  }
2401 
2402  //charge Asym vs eta
2403  if (CheckHistogram(file,
2404  (path + "/eta_asym").c_str()) &&
2405  CheckHistogram(file, (path + "/eta_neg").c_str()) && CheckHistogram(file, (path + "/eta_pos").c_str())) {
2406  TH1F* eta_neg = (TH1F*) (file->Get((path + "/eta_neg").c_str())->Clone());
2407  TH1F* eta_pos = (TH1F*) (file->Get((path + "/eta_pos").c_str())->Clone());
2408  TH1F* eta_asym = (TH1F*) (file->Get((path + "/eta_asym").c_str())->Clone());
2409  ProcessAsymHistograms(eta_neg, eta_pos, eta_asym);
2410  eta_asym->SetXTitle("track #eta");
2411  eta_asym->Write("", TObject::kOverwrite);
2412  }
2413 
2414  //charge Asym vs d0 (corrected for vertex)
2415  if (CheckHistogram(file,
2416  (path + "/trk_d0c_asym_barrel").c_str()) &&
2418  (path + "/trk_d0c_neg_barrel").c_str()) &&
2419  CheckHistogram(file, (path + "/trk_d0c_pos_barrel").c_str())) {
2420  TH1F* trk_d0c_neg_barrel = (TH1F*) (file->Get((path + "/trk_d0c_neg_barrel").c_str())->Clone());
2421  TH1F* trk_d0c_pos_barrel = (TH1F*) (file->Get((path + "/trk_d0c_pos_barrel").c_str())->Clone());
2422  TH1F* trk_d0c_asym_barrel = (TH1F*) (file->Get((path + "/trk_d0c_asym_barrel").c_str())->Clone());
2423  ProcessAsymHistograms(trk_d0c_neg_barrel, trk_d0c_pos_barrel, trk_d0c_asym_barrel);
2424  trk_d0c_asym_barrel->SetXTitle("track d_{0} [mm]");
2425  trk_d0c_asym_barrel->Write("", TObject::kOverwrite);
2426  }
2427  if (CheckHistogram(file,
2428  (path + "/trk_d0c_asym_ecc").c_str()) &&
2430  (path + "/trk_d0c_neg_ecc").c_str()) &&
2431  CheckHistogram(file, (path + "/trk_d0c_pos_ecc").c_str())) {
2432  TH1F* trk_d0c_neg_ecc = (TH1F*) (file->Get((path + "/trk_d0c_neg_ecc").c_str())->Clone());
2433  TH1F* trk_d0c_pos_ecc = (TH1F*) (file->Get((path + "/trk_d0c_pos_ecc").c_str())->Clone());
2434  TH1F* trk_d0c_asym_ecc = (TH1F*) (file->Get((path + "/trk_d0c_asym_ecc").c_str())->Clone());
2435  ProcessAsymHistograms(trk_d0c_neg_ecc, trk_d0c_pos_ecc, trk_d0c_asym_ecc);
2436  trk_d0c_asym_ecc->SetXTitle("track d_{0} [mm]");
2437  trk_d0c_asym_ecc->Write("", TObject::kOverwrite);
2438  }
2439  if (CheckHistogram(file,
2440  (path + "/trk_d0c_asym_eca").c_str()) &&
2442  (path + "/trk_d0c_neg_eca").c_str()) &&
2443  CheckHistogram(file, (path + "/trk_d0c_pos_eca").c_str())) {
2444  TH1F* trk_d0c_neg_eca = (TH1F*) (file->Get((path + "/trk_d0c_neg_eca").c_str())->Clone());
2445  TH1F* trk_d0c_pos_eca = (TH1F*) (file->Get((path + "/trk_d0c_pos_eca").c_str())->Clone());
2446  TH1F* trk_d0c_asym_eca = (TH1F*) (file->Get((path + "/trk_d0c_asym_eca").c_str())->Clone());
2447  ProcessAsymHistograms(trk_d0c_neg_eca, trk_d0c_pos_eca, trk_d0c_asym_eca);
2448  trk_d0c_asym_eca->SetXTitle("track d_{0} [mm]");
2449  trk_d0c_asym_eca->Write("", TObject::kOverwrite);
2450  }
2451  if (CheckHistogram(file,
2452  (path + "/trk_d0c_asym").c_str()) &&
2454  (path + "/trk_d0c_neg").c_str()) && CheckHistogram(file, (path + "/trk_d0c_pos").c_str())) {
2455  TH1F* trk_d0c_neg = (TH1F*) (file->Get((path + "/trk_d0c_neg").c_str())->Clone());
2456  TH1F* trk_d0c_pos = (TH1F*) (file->Get((path + "/trk_d0c_pos").c_str())->Clone());
2457  TH1F* trk_d0c_asym = (TH1F*) (file->Get((path + "/trk_d0c_asym").c_str())->Clone());
2458  ProcessAsymHistograms(trk_d0c_neg, trk_d0c_pos, trk_d0c_asym);
2459  trk_d0c_asym->SetXTitle("track d_{0} [mm]");
2460  trk_d0c_asym->Write("", TObject::kOverwrite);
2461  }
2462  //charge Asym vs z0 (corrected for vertex)
2463  if (CheckHistogram(file,
2464  (path + "/trk_z0c_asym_barrel").c_str()) &&
2466  (path + "/trk_z0c_neg_barrel").c_str()) &&
2467  CheckHistogram(file, (path + "/trk_z0c_pos_barrel").c_str())) {
2468  TH1F* trk_z0c_neg_barrel = (TH1F*) (file->Get((path + "/trk_z0c_neg_barrel").c_str())->Clone());
2469  TH1F* trk_z0c_pos_barrel = (TH1F*) (file->Get((path + "/trk_z0c_pos_barrel").c_str())->Clone());
2470  TH1F* trk_z0c_asym_barrel = (TH1F*) (file->Get((path + "/trk_z0c_asym_barrel").c_str())->Clone());
2471  ProcessAsymHistograms(trk_z0c_neg_barrel, trk_z0c_pos_barrel, trk_z0c_asym_barrel);
2472  trk_z0c_asym_barrel->SetXTitle("track z_{0} [mm]");
2473  trk_z0c_asym_barrel->Write("", TObject::kOverwrite);
2474  }
2475  if (CheckHistogram(file,
2476  (path + "/trk_z0c_asym_ecc").c_str()) &&
2478  (path + "/trk_z0c_neg_ecc").c_str()) &&
2479  CheckHistogram(file, (path + "/trk_z0c_pos_ecc").c_str())) {
2480  TH1F* trk_z0c_neg_ecc = (TH1F*) (file->Get((path + "/trk_z0c_neg_ecc").c_str())->Clone());
2481  TH1F* trk_z0c_pos_ecc = (TH1F*) (file->Get((path + "/trk_z0c_pos_ecc").c_str())->Clone());
2482  TH1F* trk_z0c_asym_ecc = (TH1F*) (file->Get((path + "/trk_z0c_asym_ecc").c_str())->Clone());
2483  ProcessAsymHistograms(trk_z0c_neg_ecc, trk_z0c_pos_ecc, trk_z0c_asym_ecc);
2484  trk_z0c_asym_ecc->SetXTitle("track z_{0} [mm]");
2485  trk_z0c_asym_ecc->Write("", TObject::kOverwrite);
2486  }
2487  if (CheckHistogram(file,
2488  (path + "/trk_z0c_asym_eca").c_str()) &&
2490  (path + "/trk_z0c_neg_eca").c_str()) &&
2491  CheckHistogram(file, (path + "/trk_z0c_pos_eca").c_str())) {
2492  TH1F* trk_z0c_neg_eca = (TH1F*) (file->Get((path + "/trk_z0c_neg_eca").c_str())->Clone());
2493  TH1F* trk_z0c_pos_eca = (TH1F*) (file->Get((path + "/trk_z0c_pos_eca").c_str())->Clone());
2494  TH1F* trk_z0c_asym_eca = (TH1F*) (file->Get((path + "/trk_z0c_asym_eca").c_str())->Clone());
2495  ProcessAsymHistograms(trk_z0c_neg_eca, trk_z0c_pos_eca, trk_z0c_asym_eca);
2496  trk_z0c_asym_eca->SetXTitle("track z_{0} [mm]");
2497  trk_z0c_asym_eca->Write("", TObject::kOverwrite);
2498  }
2499  if (CheckHistogram(file,
2500  (path + "/trk_z0c_asym").c_str()) &&
2502  (path + "/trk_z0c_neg").c_str()) && CheckHistogram(file, (path + "/trk_z0c_pos").c_str())) {
2503  TH1F* trk_z0c_neg = (TH1F*) (file->Get((path + "/trk_z0c_neg").c_str())->Clone());
2504  TH1F* trk_z0c_pos = (TH1F*) (file->Get((path + "/trk_z0c_pos").c_str())->Clone());
2505  TH1F* trk_z0c_asym = (TH1F*) (file->Get((path + "/trk_z0c_asym").c_str())->Clone());
2506  ProcessAsymHistograms(trk_z0c_neg, trk_z0c_pos, trk_z0c_asym);
2507  trk_z0c_asym->SetXTitle("track z_{0} [mm]");
2508  trk_z0c_asym->Write("", TObject::kOverwrite);
2509  }
2510  file->Write();
2511  }

◆ fitMergedFile_IDAlignMonManager()

void dqutils::MonitoringFile::fitMergedFile_IDAlignMonManager ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 30 of file MonitoringFile_IDAlignPostProcess.cxx.

31  {
32  /* std::cout << "\n";
33  std::cout << "Running Inner-Detector alignment-monitoring analysis\n";
34  std::cout << "\nWarning messages from fitting and histogram updating follow:\n\n"; */
35 
36  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
37 
38  if (f == 0 || !f->IsOpen()) {
39  //std::cerr << "MonitoringFile::fitMergedFile_IDAlignMonManager(): "
40  //<< "Input file not opened\n";
41  delete f;
42  return;
43  }
44  if (f->GetSize() < 1000.) {
45  //std::cerr << "MonitoringFile::fitMergedFile_IDAlignMonManager(): "
46 // << "MonitoringFile empty\n";
47  delete f;
48  return;
49  }
50 
51  std::string run_dir;
52  TIter next_run(f->GetListOfKeys());
53  TKey* key_run(0);
54  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
55  TObject* obj_run = key_run->ReadObj();
56  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
57  if (tdir_run != 0) {
58  std::string tdir_run_name(tdir_run->GetName());
59  if (tdir_run_name.find("run") != std::string::npos) {
60  run_dir = tdir_run_name;
61  // std::cout<<"Run_directory: "<<run_dir<<std::endl;
62  TIter next_perf(tdir_run->GetListOfKeys());
63  TKey* key_perf(0);
64  while ((key_perf = dynamic_cast<TKey*>(next_perf())) != 0) {
65  std::string perf_name(key_perf->GetName());
66  // for hist file with run_directory
67  if (perf_name.find("IDAlignMon") != std::string::npos) {
68  TObject* obj_perf = key_perf->ReadObj();
69  TDirectory* tdir_perf = dynamic_cast<TDirectory*>(obj_perf);
70  if (tdir_perf != 0) {
71  run_dir = run_dir + '/';
72  TIter next_tracks(tdir_perf->GetListOfKeys());
73  TKey* key_tracks(0);
74 
75  while ((key_tracks = dynamic_cast<TKey*>(next_tracks())) != 0) {
76  std::string tracks_name(key_tracks->GetName());
77  //std::cout<<"looking at tracks dir: "<<tracks_name<<std::endl;
78  if (tracks_name.find("Track") != std::string::npos) {
79  //std::cout<<"Found tracks name: "<<tracks_name<<std::endl;
80  TObject* obj = key_tracks->ReadObj();
81  TDirectory* tdir = dynamic_cast<TDirectory*>(obj);
82  if (tdir != 0) {
83  TIter next_module(tdir->GetListOfKeys());
84  TKey* key_module(0);
85  while ((key_module = dynamic_cast<TKey*>(next_module())) != 0) {
86  std::string module_name = key_module->GetName();
87  //std::cout<<"looking at module: "<<module_name<<std::endl;
88  if (module_name.find("Residuals") != std::string::npos) {
89  //std::cout<<"Find Module: "<<module_name<<std::endl;
90  fitMergedFile_IDAlignMonResiduals(f, run_dir, tracks_name);
91  }
92 
93  if (module_name.find("TrackSegments") != std::string::npos) {
94  //std::cout<<"Find Module: "<<module_name<<std::endl;
95  fitMergedFile_IDAlignMonTrackSegments(f, run_dir, tracks_name);
96  }
97  if (module_name.find("GenericTracks") != std::string::npos) {
98  fitMergedFile_IDAlignMonPVbiases(f, run_dir, tracks_name);
99  }
100  //This is not needed. The plots are already in the monitoring file
101  //if (module_name.find("GenericTracks")!=std::string::npos) {
102  //std::cout<<"Find Module: "<<module_name<<std::endl;
103  //fitMergedFile_IDAlignMonGenericTracks( f,run_dir,tracks_name );
104  //}
105  }
106  } else { // This was not a TDirectory, delete it!
107  delete obj;
108  }
109  }
110  }
111  } else { // This was not a TDirectory, delete it!
112  delete obj_perf;
113  }
114  }
115  }
116  }
117  // if without top run_directory
118  else if (tdir_run_name.find("IDAlignMon") != std::string::npos) {
119  //std::cout<<"without run_directory"<<std::endl;
120  TObject* obj_perf = key_run->ReadObj();
121  TDirectory* tdir_perf = dynamic_cast<TDirectory*>(obj_perf);
122  if (tdir_perf != 0) {
123  run_dir = '/';
124  TIter next_tracks(tdir_perf->GetListOfKeys());
125  TKey* key_tracks(0);
126 
127  while ((key_tracks = dynamic_cast<TKey*>(next_tracks())) != 0) {
128  std::string tracks_name(key_tracks->GetName());
129  //std::cout<<"looking at tracks dir: "<<tracks_name<<std::endl;
130  if (tracks_name.find("Tracks") != std::string::npos) {
131  //std::cout<<"Found tracks name: "<<tracks_name<<std::endl;
132  TObject* obj = key_tracks->ReadObj();
133  TDirectory* tdir = dynamic_cast<TDirectory*>(obj);
134  if (tdir != 0) {
135  TIter next_module(tdir->GetListOfKeys());
136  TKey* key_module(0);
137  while ((key_module = dynamic_cast<TKey*>(next_module())) != 0) {
138  std::string module_name = key_module->GetName();
139  //std::cout<<"looking at module: "<<module_name<<std::endl;
140  if (module_name.find("Residuals") != std::string::npos) {
141  //std::cout<<"Find Module: "<<module_name<<std::endl;
142  fitMergedFile_IDAlignMonResiduals(f, run_dir, tracks_name);
143  }
144 
145  if (module_name.find("TrackSegments") != std::string::npos) {
146  //std::cout<<"Find Module: "<<module_name<<std::endl;
147  fitMergedFile_IDAlignMonTrackSegments(f, run_dir, tracks_name);
148  }
149  //This is not needed. The plots are already in the monitoring file
150  //if (module_name.find("GenericTracks")!=std::string::npos) {
151  //std::cout<<"Find Module: "<<module_name<<std::endl;
152  // fitMergedFile_IDAlignMonGenericTracks( f,run_dir,tracks_name );
153  // }
154  }
155  } else {
156  delete obj;
157  }
158  }
159  }
160  } else {
161  delete obj_perf;
162  }
163  }
164  //else
165  //std::cerr<<"directory IDAlignMon doesn't exist !"<<std::endl;
166  } else {
167  delete obj_run;
168  }
169  }
170 
171  f->Close();
172  delete f;
173  //std::cout << "\n";
174  //std::cout << "Finish Inner-Detector alignment-monitoring analysis"<<std::endl;
175  }

◆ fitMergedFile_IDAlignMonPVbiases()

void dqutils::MonitoringFile::fitMergedFile_IDAlignMonPVbiases ( TFile *  file,
const std::string &  run_dir,
const std::string &  tracksName 
)
static

Definition at line 2514 of file MonitoringFile_IDAlignPostProcess.cxx.

2515  {
2516  std::string path;
2517  path = run_dir + "IDAlignMon/" + tracksName + "/GenericTracks/PVbiases";
2518  //path= run_dir + "IDAlignMon/InDetTrackParticles_all/GenericTracks";
2519  if (file->cd(path.c_str()) == 0) {
2520  //std::cerr << "MonitoringFile::fitMergedFile_IDAlignMonGenericTracks(): "
2521  // << "No such directory \"" << path << "\"\n";
2522  return;
2523  }
2524 
2525 
2526  //Maps vs phi_vs_eta vs eta
2527  if (CheckHistogram(file,
2528  (path + "/trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive").c_str()) &&
2529  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative").c_str())) {
2530  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive =
2531  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive").c_str())->Clone());
2532  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative =
2533  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative").c_str())->Clone());
2534 
2535  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_400MeV_600MeV_positive = new TH2F(
2536  "trk_d0_wrtPV_map_vs_phi_vs_eta_400MeV_600MeV_positive",
2537  "map d0 vs phi_vs_eta 400MeV-600MeV positive; #phi; #eta", 20, -3.1, 3.1, 20, -2.5, 2.5);
2538  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_400MeV_600MeV_negative = new TH2F(
2539  "trk_d0_wrtPV_map_vs_phi_vs_eta_400MeV_600MeV_negative",
2540  "map d0 vs phi_vs_eta 400MeV-600MeV negative; #phi; #eta", 20, -3.1, 3.1, 20, -2.5, 2.5);
2541 
2542  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_400MeV_600MeV_positive, trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_positive);
2543  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_400MeV_600MeV_negative, trk_d0_wrtPV_vs_phi_vs_eta_400MeV_600MeV_negative);
2544 
2545  trk_d0_wrtPV_map_vs_phi_vs_eta_400MeV_600MeV_positive->Write("", TObject::kOverwrite);
2546  trk_d0_wrtPV_map_vs_phi_vs_eta_400MeV_600MeV_negative->Write("", TObject::kOverwrite);
2547  }
2548 
2549  if (CheckHistogram(file,
2550  (path + "/trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive").c_str()) &&
2551  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative").c_str())) {
2552  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive =
2553  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive").c_str())->Clone());
2554  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative =
2555  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative").c_str())->Clone());
2556 
2557  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_600MeV_1GeV_positive = new TH2F(
2558  "trk_d0_wrtPV_map_vs_phi_vs_eta_600MeV_1GeV_positive", "map d0 vs phi_vs_eta 600MeV-1GeV positive; #phi; #eta",
2559  20, -3.1, 3.1, 20, -2.5, 2.5);
2560  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_600MeV_1GeV_negative = new TH2F(
2561  "trk_d0_wrtPV_map_vs_phi_vs_eta_600MeV_1GeV_negative", "map d0 vs phi_vs_eta 600MeV-1GeV negative; #phi; #eta",
2562  20, -3.1, 3.1, 20, -2.5, 2.5);
2563 
2564  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_600MeV_1GeV_positive, trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_positive);
2565  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_600MeV_1GeV_negative, trk_d0_wrtPV_vs_phi_vs_eta_600MeV_1GeV_negative);
2566 
2567  trk_d0_wrtPV_map_vs_phi_vs_eta_600MeV_1GeV_positive->Write("", TObject::kOverwrite);
2568  trk_d0_wrtPV_map_vs_phi_vs_eta_600MeV_1GeV_negative->Write("", TObject::kOverwrite);
2569  }
2570 
2571  if (CheckHistogram(file,
2572  (path + "/trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive").c_str()) &&
2573  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative").c_str())) {
2574  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive =
2575  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive").c_str())->Clone());
2576  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative =
2577  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative").c_str())->Clone());
2578 
2579  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_1GeV_2GeV_positive = new TH2F(
2580  "trk_d0_wrtPV_map_vs_phi_vs_eta_1GeV_2GeV_positive", "map d0 vs phi_vs_eta 1GeV-2GeV positive; #phi; #eta", 20,
2581  -3.1, 3.1, 20, -2.5, 2.5);
2582  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_1GeV_2GeV_negative = new TH2F(
2583  "trk_d0_wrtPV_map_vs_phi_vs_eta_1GeV_2GeV_negative", "map d0 vs phi_vs_eta 1GeV-2GeV negative; #phi; #eta", 20,
2584  -3.1, 3.1, 20, -2.5, 2.5);
2585 
2586  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_1GeV_2GeV_positive, trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_positive);
2587  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_1GeV_2GeV_negative, trk_d0_wrtPV_vs_phi_vs_eta_1GeV_2GeV_negative);
2588 
2589  trk_d0_wrtPV_map_vs_phi_vs_eta_1GeV_2GeV_positive->Write("", TObject::kOverwrite);
2590  trk_d0_wrtPV_map_vs_phi_vs_eta_1GeV_2GeV_negative->Write("", TObject::kOverwrite);
2591  }
2592 
2593  if (CheckHistogram(file,
2594  (path + "/trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive").c_str()) &&
2595  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative").c_str())) {
2596  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive =
2597  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive").c_str())->Clone());
2598  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative =
2599  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative").c_str())->Clone());
2600 
2601  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV_5GeV_positive = new TH2F(
2602  "trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV_5GeV_positive", "map d0 vs phi_vs_eta 2GeV-5GeV positive; #phi; #eta", 20,
2603  -3.1, 3.1, 20, -2.5, 2.5);
2604  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV_5GeV_negative = new TH2F(
2605  "trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV_5GeV_negative", "map d0 vs phi_vs_eta 2GeV-5GeV negative; #phi; #eta", 20,
2606  -3.1, 3.1, 20, -2.5, 2.5);
2607 
2608  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV_5GeV_positive, trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_positive);
2609  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV_5GeV_negative, trk_d0_wrtPV_vs_phi_vs_eta_2GeV_5GeV_negative);
2610 
2611  trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV_5GeV_positive->Write("", TObject::kOverwrite);
2612  trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV_5GeV_negative->Write("", TObject::kOverwrite);
2613  }
2614 
2615  if (CheckHistogram(file,
2616  (path + "/trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive").c_str()) &&
2617  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative").c_str())) {
2618  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive =
2619  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive").c_str())->Clone());
2620  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative =
2621  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative").c_str())->Clone());
2622 
2623  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_5GeV_10GeV_positive = new TH2F(
2624  "trk_d0_wrtPV_map_vs_phi_vs_eta_5GeV_10GeV_positive", "map d0 vs phi_vs_eta 5GeV-10GeV positive; #phi; #eta",
2625  20, -3.1, 3.1, 20, -2.5, 2.5);
2626  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_5GeV_10GeV_negative = new TH2F(
2627  "trk_d0_wrtPV_map_vs_phi_vs_eta_5GeV_10GeV_negative", "map d0 vs phi_vs_eta 5GeV-10GeV negative; #phi; #eta",
2628  20, -3.1, 3.1, 20, -2.5, 2.5);
2629 
2630  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_5GeV_10GeV_positive, trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_positive);
2631  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_5GeV_10GeV_negative, trk_d0_wrtPV_vs_phi_vs_eta_5GeV_10GeV_negative);
2632 
2633  trk_d0_wrtPV_map_vs_phi_vs_eta_5GeV_10GeV_positive->Write("", TObject::kOverwrite);
2634  trk_d0_wrtPV_map_vs_phi_vs_eta_5GeV_10GeV_negative->Write("", TObject::kOverwrite);
2635  }
2636 
2637  if (CheckHistogram(file,
2638  (path + "/trk_d0_wrtPV_vs_phi_vs_eta_10GeV_positive").c_str()) &&
2639  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_vs_eta_10GeV_negative").c_str())) {
2640  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_10GeV_positive =
2641  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_10GeV_positive").c_str())->Clone());
2642  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_10GeV_negative =
2643  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_10GeV_negative").c_str())->Clone());
2644 
2645  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_10GeV_positive = new TH2F("trk_d0_wrtPV_map_vs_phi_vs_eta_10GeV_positive",
2646  "map d0 vs phi_vs_eta >10GeV positive; #phi; #eta",
2647  20, -3.1, 3.1, 20, -2.5, 2.5);
2648  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_10GeV_negative = new TH2F("trk_d0_wrtPV_map_vs_phi_vs_eta_10GeV_negative",
2649  "map d0 vs phi_vs_eta >10GeV negative; #phi; #eta",
2650  20, -3.1, 3.1, 20, -2.5, 2.5);
2651 
2652  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_10GeV_positive, trk_d0_wrtPV_vs_phi_vs_eta_10GeV_positive);
2653  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_10GeV_negative, trk_d0_wrtPV_vs_phi_vs_eta_10GeV_negative);
2654 
2655  trk_d0_wrtPV_map_vs_phi_vs_eta_10GeV_positive->Write("", TObject::kOverwrite);
2656  trk_d0_wrtPV_map_vs_phi_vs_eta_10GeV_negative->Write("", TObject::kOverwrite);
2657  }
2658 
2659  if (CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_vs_eta_2GeV").c_str())) {
2660  TH3F* trk_d0_wrtPV_vs_phi_vs_eta_2GeV =
2661  (TH3F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_vs_eta_2GeV").c_str())->Clone());
2662 
2663  TH2F* trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV = new TH2F("trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV",
2664  "map d0 vs phi_vs_eta >2GeV; #phi; #eta", 20, -3.1, 3.1, 20,
2665  -2.5, 2.5);
2666 
2667  MakeMap(trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV, trk_d0_wrtPV_vs_phi_vs_eta_2GeV);
2668 
2669  trk_d0_wrtPV_map_vs_phi_vs_eta_2GeV->Write("", TObject::kOverwrite);
2670  }
2671 
2672 
2673  //Profiles vs phi
2674  if (CheckHistogram(file,
2675  (path + "/trk_d0_wrtPV_vs_phi_400MeV_600MeV_positive").c_str()) &&
2676  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_400MeV_600MeV_negative").c_str())) {
2677  TH2F* trk_d0_wrtPV_vs_phi_400MeV_600MeV_positive =
2678  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_400MeV_600MeV_positive").c_str())->Clone());
2679  TH2F* trk_d0_wrtPV_vs_phi_400MeV_600MeV_negative =
2680  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_400MeV_600MeV_negative").c_str())->Clone());
2681 
2682  TH1F* trk_d0_wrtPV_profile_vs_phi_400MeV_600MeV_positive = new TH1F(
2683  "trk_d0_wrtPV_profile_vs_phi_400MeV_600MeV_positive", "profile d0 vs phi 400MeV-600MeV positive; #phi; d0 [mm]",
2684  50, -3.1, 3.1);
2685  TH1F* trk_d0_wrtPV_profile_vs_phi_400MeV_600MeV_negative = new TH1F(
2686  "trk_d0_wrtPV_profile_vs_phi_400MeV_600MeV_negative", "profile d0 vs phi 400MeV-600MeV negative; #phi; d0 [mm]",
2687  50, -3.1, 3.1);
2688 
2689  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_400MeV_600MeV_positive, trk_d0_wrtPV_vs_phi_400MeV_600MeV_positive);
2690  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_400MeV_600MeV_negative, trk_d0_wrtPV_vs_phi_400MeV_600MeV_negative);
2691 
2692  trk_d0_wrtPV_profile_vs_phi_400MeV_600MeV_positive->Write("", TObject::kOverwrite);
2693  trk_d0_wrtPV_profile_vs_phi_400MeV_600MeV_negative->Write("", TObject::kOverwrite);
2694  }
2695 
2696  if (CheckHistogram(file,
2697  (path + "/trk_d0_wrtPV_vs_phi_600MeV_1GeV_positive").c_str()) &&
2698  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_600MeV_1GeV_negative").c_str())) {
2699  TH2F* trk_d0_wrtPV_vs_phi_600MeV_1GeV_positive =
2700  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_600MeV_1GeV_positive").c_str())->Clone());
2701  TH2F* trk_d0_wrtPV_vs_phi_600MeV_1GeV_negative =
2702  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_600MeV_1GeV_negative").c_str())->Clone());
2703 
2704  TH1F* trk_d0_wrtPV_profile_vs_phi_600MeV_1GeV_positive = new TH1F(
2705  "trk_d0_wrtPV_profile_vs_phi_600MeV_1GeV_positive", "profile d0 vs phi 600MeV-1GeV positive; #phi; d0 [mm]", 50,
2706  -3.1, 3.1);
2707  TH1F* trk_d0_wrtPV_profile_vs_phi_600MeV_1GeV_negative = new TH1F(
2708  "trk_d0_wrtPV_profile_vs_phi_600MeV_1GeV_negative", "profile d0 vs phi 600MeV-1GeV negative; #phi; d0 [mm]", 50,
2709  -3.1, 3.1);
2710 
2711  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_600MeV_1GeV_positive, trk_d0_wrtPV_vs_phi_600MeV_1GeV_positive);
2712  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_600MeV_1GeV_negative, trk_d0_wrtPV_vs_phi_600MeV_1GeV_negative);
2713 
2714  trk_d0_wrtPV_profile_vs_phi_600MeV_1GeV_positive->Write("", TObject::kOverwrite);
2715  trk_d0_wrtPV_profile_vs_phi_600MeV_1GeV_negative->Write("", TObject::kOverwrite);
2716  }
2717 
2718  if (CheckHistogram(file,
2719  (path + "/trk_d0_wrtPV_vs_phi_1GeV_2GeV_positive").c_str()) &&
2720  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_1GeV_2GeV_negative").c_str())) {
2721  TH2F* trk_d0_wrtPV_vs_phi_1GeV_2GeV_positive =
2722  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_1GeV_2GeV_positive").c_str())->Clone());
2723  TH2F* trk_d0_wrtPV_vs_phi_1GeV_2GeV_negative =
2724  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_1GeV_2GeV_negative").c_str())->Clone());
2725 
2726  TH1F* trk_d0_wrtPV_profile_vs_phi_1GeV_2GeV_positive = new TH1F("trk_d0_wrtPV_profile_vs_phi_1GeV_2GeV_positive",
2727  "profile d0 vs phi 1GeV-2GeV positive; #phi; d0 [mm]", 50, -3.1,
2728  3.1);
2729  TH1F* trk_d0_wrtPV_profile_vs_phi_1GeV_2GeV_negative = new TH1F("trk_d0_wrtPV_profile_vs_phi_1GeV_2GeV_negative",
2730  "profile d0 vs phi 1GeV-2GeV negative; #phi; d0 [mm]", 50, -3.1,
2731  3.1);
2732 
2733  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_1GeV_2GeV_positive, trk_d0_wrtPV_vs_phi_1GeV_2GeV_positive);
2734  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_1GeV_2GeV_negative, trk_d0_wrtPV_vs_phi_1GeV_2GeV_negative);
2735 
2736  trk_d0_wrtPV_profile_vs_phi_1GeV_2GeV_positive->Write("", TObject::kOverwrite);
2737  trk_d0_wrtPV_profile_vs_phi_1GeV_2GeV_negative->Write("", TObject::kOverwrite);
2738  }
2739 
2740  if (CheckHistogram(file,
2741  (path + "/trk_d0_wrtPV_vs_phi_2GeV_5GeV_positive").c_str()) &&
2742  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_2GeV_5GeV_negative").c_str())) {
2743  TH2F* trk_d0_wrtPV_vs_phi_2GeV_5GeV_positive =
2744  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_2GeV_5GeV_positive").c_str())->Clone());
2745  TH2F* trk_d0_wrtPV_vs_phi_2GeV_5GeV_negative =
2746  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_2GeV_5GeV_negative").c_str())->Clone());
2747 
2748  TH1F* trk_d0_wrtPV_profile_vs_phi_2GeV_5GeV_positive = new TH1F("trk_d0_wrtPV_profile_vs_phi_2GeV_5GeV_positive",
2749  "profile d0 vs phi 2GeV-5GeV positive; #phi; d0 [mm]", 50, -3.1,
2750  3.1);
2751  TH1F* trk_d0_wrtPV_profile_vs_phi_2GeV_5GeV_negative = new TH1F("trk_d0_wrtPV_profile_vs_phi_2GeV_5GeV_negative",
2752  "profile d0 vs phi 2GeV-5GeV negative; #phi; d0 [mm]", 50, -3.1,
2753  3.1);
2754 
2755  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_2GeV_5GeV_positive, trk_d0_wrtPV_vs_phi_2GeV_5GeV_positive);
2756  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_2GeV_5GeV_negative, trk_d0_wrtPV_vs_phi_2GeV_5GeV_negative);
2757 
2758  trk_d0_wrtPV_profile_vs_phi_2GeV_5GeV_positive->Write("", TObject::kOverwrite);
2759  trk_d0_wrtPV_profile_vs_phi_2GeV_5GeV_negative->Write("", TObject::kOverwrite);
2760  }
2761 
2762  if (CheckHistogram(file,
2763  (path + "/trk_d0_wrtPV_vs_phi_5GeV_10GeV_positive").c_str()) &&
2764  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_5GeV_10GeV_negative").c_str())) {
2765  TH2F* trk_d0_wrtPV_vs_phi_5GeV_10GeV_positive =
2766  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_5GeV_10GeV_positive").c_str())->Clone());
2767  TH2F* trk_d0_wrtPV_vs_phi_5GeV_10GeV_negative =
2768  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_5GeV_10GeV_negative").c_str())->Clone());
2769 
2770  TH1F* trk_d0_wrtPV_profile_vs_phi_5GeV_10GeV_positive = new TH1F(
2771  "trk_d0_wrtPV_profile_vs_phi_5GeV_10GeV_positive", "profile d0 vs phi 5GeV-10GeV positive; #phi; d0 [mm]", 50,
2772  -3.1, 3.1);
2773  TH1F* trk_d0_wrtPV_profile_vs_phi_5GeV_10GeV_negative = new TH1F(
2774  "trk_d0_wrtPV_profile_vs_phi_5GeV_10GeV_negative", "profile d0 vs phi 5GeV-10GeV negative; #phi; d0 [mm]", 50,
2775  -3.1, 3.1);
2776 
2777  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_5GeV_10GeV_positive, trk_d0_wrtPV_vs_phi_5GeV_10GeV_positive);
2778  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_5GeV_10GeV_negative, trk_d0_wrtPV_vs_phi_5GeV_10GeV_negative);
2779 
2780  trk_d0_wrtPV_profile_vs_phi_5GeV_10GeV_positive->Write("", TObject::kOverwrite);
2781  trk_d0_wrtPV_profile_vs_phi_5GeV_10GeV_negative->Write("", TObject::kOverwrite);
2782  }
2783 
2784  if (CheckHistogram(file,
2785  (path + "/trk_d0_wrtPV_vs_phi_10GeV_positive").c_str()) &&
2786  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_phi_10GeV_negative").c_str())) {
2787  TH2F* trk_d0_wrtPV_vs_phi_10GeV_positive =
2788  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_10GeV_positive").c_str())->Clone());
2789  TH2F* trk_d0_wrtPV_vs_phi_10GeV_negative =
2790  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_phi_10GeV_negative").c_str())->Clone());
2791 
2792  TH1F* trk_d0_wrtPV_profile_vs_phi_10GeV_positive = new TH1F("trk_d0_wrtPV_profile_vs_phi_10GeV_positive",
2793  "profile d0 vs phi >10GeV positive; #phi; d0 [mm]",
2794  50, -3.1, 3.1);
2795  TH1F* trk_d0_wrtPV_profile_vs_phi_10GeV_negative = new TH1F("trk_d0_wrtPV_profile_vs_phi_10GeV_negative",
2796  "profile d0 vs phi >10GeV negative; #phi; d0 [mm]",
2797  50, -3.1, 3.1);
2798 
2799  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_10GeV_positive, trk_d0_wrtPV_vs_phi_10GeV_positive);
2800  Make1DProfile(trk_d0_wrtPV_profile_vs_phi_10GeV_negative, trk_d0_wrtPV_vs_phi_10GeV_negative);
2801 
2802  trk_d0_wrtPV_profile_vs_phi_10GeV_positive->Write("", TObject::kOverwrite);
2803  trk_d0_wrtPV_profile_vs_phi_10GeV_negative->Write("", TObject::kOverwrite);
2804  }
2805 
2806  //Profiles vs eta
2807  if (CheckHistogram(file,
2808  (path + "/trk_d0_wrtPV_vs_eta_400MeV_600MeV_positive").c_str()) &&
2809  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_eta_400MeV_600MeV_negative").c_str())) {
2810  TH2F* trk_d0_wrtPV_vs_eta_400MeV_600MeV_positive =
2811  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_400MeV_600MeV_positive").c_str())->Clone());
2812  TH2F* trk_d0_wrtPV_vs_eta_400MeV_600MeV_negative =
2813  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_400MeV_600MeV_negative").c_str())->Clone());
2814 
2815  TH1F* trk_d0_wrtPV_profile_vs_eta_400MeV_600MeV_positive = new TH1F(
2816  "trk_d0_wrtPV_profile_vs_eta_400MeV_600MeV_positive", "profile d0 vs eta 400MeV-600MeV positive; #eta; d0 [mm]",
2817  50, -2.5, 2.5);
2818  TH1F* trk_d0_wrtPV_profile_vs_eta_400MeV_600MeV_negative = new TH1F(
2819  "trk_d0_wrtPV_profile_vs_eta_400MeV_600MeV_negative", "profile d0 vs eta 400MeV-600MeV negative; #eta; d0 [mm]",
2820  50, -2.5, 2.5);
2821 
2822  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_400MeV_600MeV_positive, trk_d0_wrtPV_vs_eta_400MeV_600MeV_positive);
2823  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_400MeV_600MeV_negative, trk_d0_wrtPV_vs_eta_400MeV_600MeV_negative);
2824 
2825  trk_d0_wrtPV_profile_vs_eta_400MeV_600MeV_positive->Write("", TObject::kOverwrite);
2826  trk_d0_wrtPV_profile_vs_eta_400MeV_600MeV_negative->Write("", TObject::kOverwrite);
2827  }
2828 
2829  if (CheckHistogram(file,
2830  (path + "/trk_d0_wrtPV_vs_eta_600MeV_1GeV_positive").c_str()) &&
2831  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_eta_600MeV_1GeV_negative").c_str())) {
2832  TH2F* trk_d0_wrtPV_vs_eta_600MeV_1GeV_positive =
2833  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_600MeV_1GeV_positive").c_str())->Clone());
2834  TH2F* trk_d0_wrtPV_vs_eta_600MeV_1GeV_negative =
2835  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_600MeV_1GeV_negative").c_str())->Clone());
2836 
2837  TH1F* trk_d0_wrtPV_profile_vs_eta_600MeV_1GeV_positive = new TH1F(
2838  "trk_d0_wrtPV_profile_vs_eta_600MeV_1GeV_positive", "profile d0 vs eta 600MeV-1GeV positive; #eta; d0 [mm]", 50,
2839  -2.5, 2.5);
2840  TH1F* trk_d0_wrtPV_profile_vs_eta_600MeV_1GeV_negative = new TH1F(
2841  "trk_d0_wrtPV_profile_vs_eta_600MeV_1GeV_negative", "profile d0 vs eta 600MeV-1GeV negative; #eta; d0 [mm]", 50,
2842  -2.5, 2.5);
2843 
2844  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_600MeV_1GeV_positive, trk_d0_wrtPV_vs_eta_600MeV_1GeV_positive);
2845  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_600MeV_1GeV_negative, trk_d0_wrtPV_vs_eta_600MeV_1GeV_negative);
2846 
2847  trk_d0_wrtPV_profile_vs_eta_600MeV_1GeV_positive->Write("", TObject::kOverwrite);
2848  trk_d0_wrtPV_profile_vs_eta_600MeV_1GeV_negative->Write("", TObject::kOverwrite);
2849  }
2850 
2851  if (CheckHistogram(file,
2852  (path + "/trk_d0_wrtPV_vs_eta_1GeV_2GeV_positive").c_str()) &&
2853  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_eta_1GeV_2GeV_negative").c_str())) {
2854  TH2F* trk_d0_wrtPV_vs_eta_1GeV_2GeV_positive =
2855  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_1GeV_2GeV_positive").c_str())->Clone());
2856  TH2F* trk_d0_wrtPV_vs_eta_1GeV_2GeV_negative =
2857  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_1GeV_2GeV_negative").c_str())->Clone());
2858 
2859  TH1F* trk_d0_wrtPV_profile_vs_eta_1GeV_2GeV_positive = new TH1F("trk_d0_wrtPV_profile_vs_eta_1GeV_2GeV_positive",
2860  "profile d0 vs eta 1GeV-2GeV positive; #eta; d0 [mm]", 50, -2.5,
2861  2.5);
2862  TH1F* trk_d0_wrtPV_profile_vs_eta_1GeV_2GeV_negative = new TH1F("trk_d0_wrtPV_profile_vs_eta_1GeV_2GeV_negative",
2863  "profile d0 vs eta 1GeV-2GeV negative; #eta; d0 [mm]", 50, -2.5,
2864  2.5);
2865 
2866  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_1GeV_2GeV_positive, trk_d0_wrtPV_vs_eta_1GeV_2GeV_positive);
2867  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_1GeV_2GeV_negative, trk_d0_wrtPV_vs_eta_1GeV_2GeV_negative);
2868 
2869  trk_d0_wrtPV_profile_vs_eta_1GeV_2GeV_positive->Write("", TObject::kOverwrite);
2870  trk_d0_wrtPV_profile_vs_eta_1GeV_2GeV_negative->Write("", TObject::kOverwrite);
2871  }
2872 
2873  if (CheckHistogram(file,
2874  (path + "/trk_d0_wrtPV_vs_eta_2GeV_5GeV_positive").c_str()) &&
2875  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_eta_2GeV_5GeV_negative").c_str())) {
2876  TH2F* trk_d0_wrtPV_vs_eta_2GeV_5GeV_positive =
2877  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_2GeV_5GeV_positive").c_str())->Clone());
2878  TH2F* trk_d0_wrtPV_vs_eta_2GeV_5GeV_negative =
2879  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_2GeV_5GeV_negative").c_str())->Clone());
2880 
2881  TH1F* trk_d0_wrtPV_profile_vs_eta_2GeV_5GeV_positive = new TH1F("trk_d0_wrtPV_profile_vs_eta_2GeV_5GeV_positive",
2882  "profile d0 vs eta 2GeV-5GeV positive; #eta; d0 [mm]", 50, -2.5,
2883  2.5);
2884  TH1F* trk_d0_wrtPV_profile_vs_eta_2GeV_5GeV_negative = new TH1F("trk_d0_wrtPV_profile_vs_eta_2GeV_5GeV_negative",
2885  "profile d0 vs eta 2GeV-5GeV negative; #eta; d0 [mm]", 50, -2.5,
2886  2.5);
2887 
2888  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_2GeV_5GeV_positive, trk_d0_wrtPV_vs_eta_2GeV_5GeV_positive);
2889  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_2GeV_5GeV_negative, trk_d0_wrtPV_vs_eta_2GeV_5GeV_negative);
2890 
2891  trk_d0_wrtPV_profile_vs_eta_2GeV_5GeV_positive->Write("", TObject::kOverwrite);
2892  trk_d0_wrtPV_profile_vs_eta_2GeV_5GeV_negative->Write("", TObject::kOverwrite);
2893  }
2894 
2895  if (CheckHistogram(file,
2896  (path + "/trk_d0_wrtPV_vs_eta_5GeV_10GeV_positive").c_str()) &&
2897  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_eta_5GeV_10GeV_negative").c_str())) {
2898  TH2F* trk_d0_wrtPV_vs_eta_5GeV_10GeV_positive =
2899  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_5GeV_10GeV_positive").c_str())->Clone());
2900  TH2F* trk_d0_wrtPV_vs_eta_5GeV_10GeV_negative =
2901  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_5GeV_10GeV_negative").c_str())->Clone());
2902 
2903  TH1F* trk_d0_wrtPV_profile_vs_eta_5GeV_10GeV_positive = new TH1F(
2904  "trk_d0_wrtPV_profile_vs_eta_5GeV_10GeV_positive", "profile d0 vs eta 5GeV-10GeV positive; #eta; d0 [mm]", 50,
2905  -2.5, 2.5);
2906  TH1F* trk_d0_wrtPV_profile_vs_eta_5GeV_10GeV_negative = new TH1F(
2907  "trk_d0_wrtPV_profile_vs_eta_5GeV_10GeV_negative", "profile d0 vs eta 5GeV-10GeV negative; #eta; d0 [mm]", 50,
2908  -2.5, 2.5);
2909 
2910  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_5GeV_10GeV_positive, trk_d0_wrtPV_vs_eta_5GeV_10GeV_positive);
2911  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_5GeV_10GeV_negative, trk_d0_wrtPV_vs_eta_5GeV_10GeV_negative);
2912 
2913  trk_d0_wrtPV_profile_vs_eta_5GeV_10GeV_positive->Write("", TObject::kOverwrite);
2914  trk_d0_wrtPV_profile_vs_eta_5GeV_10GeV_negative->Write("", TObject::kOverwrite);
2915  }
2916 
2917  if (CheckHistogram(file,
2918  (path + "/trk_d0_wrtPV_vs_eta_10GeV_positive").c_str()) &&
2919  CheckHistogram(file, (path + "/trk_d0_wrtPV_vs_eta_10GeV_negative").c_str())) {
2920  TH2F* trk_d0_wrtPV_vs_eta_10GeV_positive =
2921  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_10GeV_positive").c_str())->Clone());
2922  TH2F* trk_d0_wrtPV_vs_eta_10GeV_negative =
2923  (TH2F*) (file->Get((path + "/trk_d0_wrtPV_vs_eta_10GeV_negative").c_str())->Clone());
2924 
2925  TH1F* trk_d0_wrtPV_profile_vs_eta_10GeV_positive = new TH1F("trk_d0_wrtPV_profile_vs_eta_10GeV_positive",
2926  "profile d0 vs eta >10GeV positive; #eta; d0 [mm]",
2927  50, -2.5, 2.5);
2928  TH1F* trk_d0_wrtPV_profile_vs_eta_10GeV_negative = new TH1F("trk_d0_wrtPV_profile_vs_eta_10GeV_negative",
2929  "profile d0 vs eta >10GeV negative; #eta; d0 [mm]",
2930  50, -2.5, 2.5);
2931 
2932  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_10GeV_positive, trk_d0_wrtPV_vs_eta_10GeV_positive);
2933  Make1DProfile(trk_d0_wrtPV_profile_vs_eta_10GeV_negative, trk_d0_wrtPV_vs_eta_10GeV_negative);
2934 
2935  trk_d0_wrtPV_profile_vs_eta_10GeV_positive->Write("", TObject::kOverwrite);
2936  trk_d0_wrtPV_profile_vs_eta_10GeV_negative->Write("", TObject::kOverwrite);
2937  }
2938 
2939  file->Write();
2940  }

◆ fitMergedFile_IDAlignMonResiduals()

void dqutils::MonitoringFile::fitMergedFile_IDAlignMonResiduals ( TFile *  f,
const std::string &  run_dir,
const std::string &  TriggerName 
)
static

Definition at line 472 of file MonitoringFile_IDAlignPostProcess.cxx.

473  {
474  const float minSiResMeanWindow = -0.1;
475  const float maxSiResMeanWindow = 0.1;
476  const float minSiResWidthWindow = 0.0;
477  const float maxSiResWidthWindow = 0.3;
478  const float minSiPullWidthWindow = 0.0;
479  const float maxSiPullWidthWindow = 2.0;
480 
481  bool doOverlapResiduals = false;
482 
483  std::string path;
484  path = run_dir + "IDAlignMon/" + tracksName + "/Residuals";
485  if (f->cd(path.c_str()) == 0) {
486  //std::cerr << "MonitoringFile::fitMergedFile_IDAlignMonResiduals(): "
487  // << "No such directory \"" << path << "\"\n";
488  return;
489  }
490 
491  TObjArray* plots = new TObjArray[10];//used for performing operations on histos
492 
493  //2d histograms from which the fits/means will be taken - checking they exist
494  if (!CheckHistogram(f, (path + "/si_barrel_pullX").c_str())) return;
495 
496  if (!CheckHistogram(f, (path + "/si_eca_pullX").c_str())) return;
497 
498  if (!CheckHistogram(f, (path + "/si_ecc_pullX").c_str())) return;
499 
500  if (!CheckHistogram(f, (path + "/si_barrel_pullY").c_str())) return;
501 
502  if (!CheckHistogram(f, (path + "/si_eca_pullY").c_str())) return;
503 
504  if (!CheckHistogram(f, (path + "/si_ecc_pullY").c_str())) return;
505 
506  if (!CheckHistogram(f, (path + "/si_barrel_resX").c_str())) return;
507 
508  if (!CheckHistogram(f, (path + "/si_eca_resX").c_str())) return;
509 
510  if (!CheckHistogram(f, (path + "/si_ecc_resX").c_str())) return;
511 
512  if (!CheckHistogram(f, (path + "/si_barrel_resY").c_str())) return;
513 
514  if (!CheckHistogram(f, (path + "/si_eca_resY").c_str())) return;
515 
516  if (!CheckHistogram(f, (path + "/si_ecc_resY").c_str())) return;
517 
518  if (!CheckHistogram(f, (path + "/pix_eca_xresvsmodphi_2d").c_str())) return;
519 
520  if (!CheckHistogram(f, (path + "/pix_eca_yresvsmodphi_2d").c_str())) return;
521 
522  if (!CheckHistogram(f, (path + "/pix_ecc_xresvsmodphi_2d").c_str())) return;
523 
524  if (!CheckHistogram(f, (path + "/pix_ecc_yresvsmodphi_2d").c_str())) return;
525 
526  if (!CheckHistogram(f, (path + "/sct_eca_xresvsmodphi_2d").c_str())) return;
527 
528  if (!CheckHistogram(f, (path + "/sct_ecc_xresvsmodphi_2d").c_str())) return;
529 
530  if (!CheckHistogram(f, (path + "/pix_b0_xresvsmodetaphi_3d").c_str())) return;
531 
532  if (!CheckHistogram(f, (path + "/pix_b1_xresvsmodetaphi_3d").c_str())) return;
533 
534  if (!CheckHistogram(f, (path + "/pix_b2_xresvsmodetaphi_3d").c_str())) return;
535 
536  if (!CheckHistogram(f, (path + "/pix_b3_xresvsmodetaphi_3d").c_str())) return;
537 
538  if (!CheckHistogram(f, (path + "/pix_b0_yresvsmodetaphi_3d").c_str())) return;
539 
540  if (!CheckHistogram(f, (path + "/pix_b1_yresvsmodetaphi_3d").c_str())) return;
541 
542  if (!CheckHistogram(f, (path + "/pix_b2_yresvsmodetaphi_3d").c_str())) return;
543 
544  if (!CheckHistogram(f, (path + "/pix_b3_yresvsmodetaphi_3d").c_str())) return;
545 
546  if (!CheckHistogram(f, (path + "/sct_b0_xresvsmodetaphi_3d").c_str())) return;
547 
548  if (!CheckHistogram(f, (path + "/sct_b1_xresvsmodetaphi_3d").c_str())) return;
549 
550  if (!CheckHistogram(f, (path + "/sct_b2_xresvsmodetaphi_3d").c_str())) return;
551 
552  if (!CheckHistogram(f, (path + "/sct_b3_xresvsmodetaphi_3d").c_str())) return;
553 
554  if (CheckHistogram(f, (path + "/pix_b0_Oxresxvsmodetaphi_3d").c_str())) {
555  doOverlapResiduals = true;
556  if (!CheckHistogram(f, (path + "/pix_b0_Oxresxvsmodetaphi_3d").c_str())) return;
557 
558  if (!CheckHistogram(f, (path + "/pix_b1_Oxresxvsmodetaphi_3d").c_str())) return;
559 
560  if (!CheckHistogram(f, (path + "/pix_b2_Oxresxvsmodetaphi_3d").c_str())) return;
561 
562  if (!CheckHistogram(f, (path + "/pix_b3_Oxresxvsmodetaphi_3d").c_str())) return;
563 
564  if (!CheckHistogram(f, (path + "/pix_b0_Oxresyvsmodetaphi_3d").c_str())) return;
565 
566  if (!CheckHistogram(f, (path + "/pix_b1_Oxresyvsmodetaphi_3d").c_str())) return;
567 
568  if (!CheckHistogram(f, (path + "/pix_b2_Oxresyvsmodetaphi_3d").c_str())) return;
569 
570  if (!CheckHistogram(f, (path + "/pix_b3_Oxresyvsmodetaphi_3d").c_str())) return;
571 
572  if (!CheckHistogram(f, (path + "/pix_b0_Oyresyvsmodetaphi_3d").c_str())) return;
573 
574  if (!CheckHistogram(f, (path + "/pix_b1_Oyresyvsmodetaphi_3d").c_str())) return;
575 
576  if (!CheckHistogram(f, (path + "/pix_b2_Oyresyvsmodetaphi_3d").c_str())) return;
577 
578  if (!CheckHistogram(f, (path + "/pix_b3_Oyresyvsmodetaphi_3d").c_str())) return;
579 
580  if (!CheckHistogram(f, (path + "/pix_b0_Oyresxvsmodetaphi_3d").c_str())) return;
581 
582  if (!CheckHistogram(f, (path + "/pix_b1_Oyresxvsmodetaphi_3d").c_str())) return;
583 
584  if (!CheckHistogram(f, (path + "/pix_b2_Oyresxvsmodetaphi_3d").c_str())) return;
585 
586  if (!CheckHistogram(f, (path + "/pix_b3_Oyresyvsmodetaphi_3d").c_str())) return;
587 
588 
589  if (!CheckHistogram(f, (path + "/sct_b0_Oxresxvsmodetaphi_3d").c_str())) return;
590 
591  if (!CheckHistogram(f, (path + "/sct_b1_Oxresxvsmodetaphi_3d").c_str())) return;
592 
593  if (!CheckHistogram(f, (path + "/sct_b2_Oxresxvsmodetaphi_3d").c_str())) return;
594 
595  if (!CheckHistogram(f, (path + "/sct_b3_Oxresxvsmodetaphi_3d").c_str())) return;
596 
597  if (!CheckHistogram(f, (path + "/sct_b0_Oyresxvsmodetaphi_3d").c_str())) return;
598 
599  if (!CheckHistogram(f, (path + "/sct_b1_Oyresxvsmodetaphi_3d").c_str())) return;
600 
601  if (!CheckHistogram(f, (path + "/sct_b2_Oyresxvsmodetaphi_3d").c_str())) return;
602 
603  if (!CheckHistogram(f, (path + "/sct_b3_Oyresxvsmodetaphi_3d").c_str())) return;
604 
605  //Check if the bowing histograms exist.
606 
607  if (!CheckHistogram(f, (path + "/pix_b0_resXvsetaLumiBlock").c_str())) return;
608 
609  if (!CheckHistogram(f, (path + "/pix_b0_resXvsetaLumiBlock_planars").c_str())) return;
610  }
611  //else std::cout << "no overlap residual histograms found - will not process overlap residuals" << std::endl;
612 
613  //get the 2d histograms from the file
614  TH2F* si_barrel_pullX = (TH2F*) (f->Get((path + "/si_barrel_pullX").c_str()));
615  TH2F* si_eca_pullX = (TH2F*) (f->Get((path + "/si_eca_pullX").c_str()));
616  TH2F* si_ecc_pullX = (TH2F*) (f->Get((path + "/si_ecc_pullX").c_str()));
617  TH2F* si_barrel_pullY = (TH2F*) (f->Get((path + "/si_barrel_pullY").c_str()));
618  TH2F* si_eca_pullY = (TH2F*) (f->Get((path + "/si_eca_pullY").c_str()));
619  TH2F* si_ecc_pullY = (TH2F*) (f->Get((path + "/si_ecc_pullY").c_str()));
620 
621  TH2F* si_barrel_resX = (TH2F*) (f->Get((path + "/si_barrel_resX").c_str()));
622  TH2F* si_eca_resX = (TH2F*) (f->Get((path + "/si_eca_resX").c_str()));
623  TH2F* si_ecc_resX = (TH2F*) (f->Get((path + "/si_ecc_resX").c_str()));
624  TH2F* si_barrel_resY = (TH2F*) (f->Get((path + "/si_barrel_resY").c_str()));
625  TH2F* si_eca_resY = (TH2F*) (f->Get((path + "/si_eca_resY").c_str()));
626  TH2F* si_ecc_resY = (TH2F*) (f->Get((path + "/si_ecc_resY").c_str()));
627 
628  TH2F* pix_eca_xresvsmodphi_2d = (TH2F*) (f->Get((path + "/pix_eca_xresvsmodphi_2d").c_str()));
629  TH2F* pix_eca_yresvsmodphi_2d = (TH2F*) (f->Get((path + "/pix_eca_yresvsmodphi_2d").c_str()));
630  TH2F* pix_ecc_xresvsmodphi_2d = (TH2F*) (f->Get((path + "/pix_ecc_xresvsmodphi_2d").c_str()));
631  TH2F* pix_ecc_yresvsmodphi_2d = (TH2F*) (f->Get((path + "/pix_ecc_yresvsmodphi_2d").c_str()));
632  TH2F* sct_eca_xresvsmodphi_2d = (TH2F*) (f->Get((path + "/sct_eca_xresvsmodphi_2d").c_str()));
633  TH2F* sct_ecc_xresvsmodphi_2d = (TH2F*) (f->Get((path + "/sct_ecc_xresvsmodphi_2d").c_str()));
634 
635  //3-d histograms
636  TH3F* pix_b0_xresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b0_xresvsmodetaphi_3d").c_str()));
637  TH3F* pix_b1_xresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b1_xresvsmodetaphi_3d").c_str()));
638  TH3F* pix_b2_xresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b2_xresvsmodetaphi_3d").c_str()));
639  TH3F* pix_b3_xresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b3_xresvsmodetaphi_3d").c_str()));
640  TH3F* pix_b0_yresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b0_yresvsmodetaphi_3d").c_str()));
641  TH3F* pix_b1_yresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b1_yresvsmodetaphi_3d").c_str()));
642  TH3F* pix_b2_yresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b2_yresvsmodetaphi_3d").c_str()));
643  TH3F* pix_b3_yresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b3_yresvsmodetaphi_3d").c_str()));
644  TH3F* sct_b0_xresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b0_xresvsmodetaphi_3d").c_str()));
645  TH3F* sct_b1_xresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b1_xresvsmodetaphi_3d").c_str()));
646  TH3F* sct_b2_xresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b2_xresvsmodetaphi_3d").c_str()));
647  TH3F* sct_b3_xresvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b3_xresvsmodetaphi_3d").c_str()));
648 
649  // Get the 2DProfiles
650 
651  //TProfile2D* m_pix_b0_resXvsetaLumiBlock = (TProfile2D*)
652  // (f->Get((path+"/pix_b0_resXvsetaLumiBlock").c_str()));
653  //TProfile2D* m_pix_b0_resXvsetaLumiBlock_planars = (TProfile2D*)
654  // (f->Get((path+"/pix_b0_resXvsetaLumiBlock_planars").c_str()));
655 
656  //TH1F* m_pix_b0_mag_vs_lb = new TH1F("pix_b0_mag_vs_lb","pix_b0_mag_vs_lb",1024,0,1024);
657  //TH1F* m_pix_b0_base_vs_lb = new TH1F("pix_b0_base_vs_lb","pix_b0_base_vs_lb",1024,0,1024);
658 
659  //MakeBowingFit(m_pix_b0_resXvsetaLumiBlock,m_pix_b0_mag_vs_lb,m_pix_b0_base_vs_lb);
660 
661  // Ideally we would like to clone the existing histograms from the file instead of recreating them here
662  // but there seems to be no way to then persistify the cloned histograms (i.e. write them back to the file)
663  const Int_t nx = 21;
664  TString siliconLayersBarrel[12] = {
665  "Pix L0", "Pix L1", "Pix L2", "Pix L3", "SCT L0 S0", "S1", "SCT L1 S0", "S1", "SCT L2 S0", "S1", "SCT L3 S0", "S1"
666  };
667  TString siliconLayers[nx] = {
668  "Pix L0", "Pix L1", "Pix L2", "SCT L0 S0", "S1", "SCT L1 S0", "S1", "SCT L2 S0", "S1", "SCT L3 S0", "S1",
669  "SCT L4 S0", "S1", "SCT L5 S0", "S1", "SCT L6 S0", "S1", "SCT L7 S0", "S1", "SCT L8 S0", "S1"
670  };
671 
672  //pull width for each layer in Silicon barrel and endcaps
673  TH1F* si_barrel_pullX_width = new TH1F("si_barrel_pullX_width", "Pull X Gaussian Width vs Silicon Barrel Layer", 12,
674  -0.5, 11.5);
675  for (int i = 1; i <= 12; i++) si_barrel_pullX_width->GetXaxis()->SetBinLabel(i, siliconLayersBarrel[i - 1]);
676  si_barrel_pullX_width->GetYaxis()->SetTitle("Pull X Gaussian Width");
677  TH1F* si_eca_pullX_width = new TH1F("si_eca_pullX_width", "Pull X Gaussian Width vs Silicon ECA Layer", 21, -0.5,
678  20.5);
679  for (int i = 1; i <= nx; i++) si_eca_pullX_width->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
680  si_eca_pullX_width->GetYaxis()->SetTitle("Pull X Gaussian Width");
681  TH1F* si_ecc_pullX_width = new TH1F("si_ecc_pullX_width", "Pull X Gaussian Width vs Silicon ECC Layer", 21, -0.5,
682  20.5);
683  for (int i = 1; i <= nx; i++) si_ecc_pullX_width->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
684  si_ecc_pullX_width->GetYaxis()->SetTitle("Pull X Gaussian Width");
685  TH1F* si_barrel_pullY_width = new TH1F("si_barrel_pullY_width", "Pull Y Gaussian Width vs Silicon Barrel Layer", 12,
686  -0.5, 11.5);
687  for (int i = 1; i <= 12; i++) si_barrel_pullY_width->GetXaxis()->SetBinLabel(i, siliconLayersBarrel[i - 1]);
688  si_barrel_pullY_width->GetYaxis()->SetTitle("Pull Y Gaussian Width");
689  TH1F* si_eca_pullY_width = new TH1F("si_eca_pullY_width", "Pull Y Gaussian Width vs Silicon ECA Layer", 21, -0.5,
690  20.5);
691  for (int i = 1; i <= nx; i++) si_eca_pullY_width->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
692  si_eca_pullY_width->GetYaxis()->SetTitle("Pull Y Gaussian Width");
693  TH1F* si_ecc_pullY_width = new TH1F("si_ecc_pullY_width", "Pull Y Gaussian Width vs Silicon ECC Layer", 21, -0.5,
694  20.5);
695  for (int i = 1; i <= nx; i++) si_ecc_pullY_width->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
696  si_ecc_pullY_width->GetYaxis()->SetTitle("Pull Y Gaussian Width");
697  fillGaussianMeanOrWidth(si_barrel_pullX, si_barrel_pullX_width, -6.0, 6.0, 1);
698  fillGaussianMeanOrWidth(si_barrel_pullY, si_barrel_pullY_width, -6.0, 6.0, 1);
699  fillGaussianMeanOrWidth(si_eca_pullX, si_eca_pullX_width, -6.0, 6.0, 1);
700  fillGaussianMeanOrWidth(si_eca_pullY, si_eca_pullY_width, -6.0, 6.0, 1);
701  fillGaussianMeanOrWidth(si_ecc_pullX, si_ecc_pullX_width, -6.0, 6.0, 1);
702  fillGaussianMeanOrWidth(si_ecc_pullY, si_ecc_pullY_width, -6.0, 6.0, 1);
703 
704  //pull mean for each layer in Silicon barrel and endcaps
705  TH1F* si_barrel_pullX_mean = new TH1F("si_barrel_pullX_mean", "Pull X Gaussian Mean vs Silicon Barrel Layer", 12,
706  -0.5, 11.5);
707  for (int i = 1; i <= 12; i++) si_barrel_pullX_mean->GetXaxis()->SetBinLabel(i, siliconLayersBarrel[i - 1]);
708  si_barrel_pullX_mean->GetYaxis()->SetTitle("Pull X Gaussian Mean");
709  TH1F* si_eca_pullX_mean =
710  new TH1F("si_eca_pullX_mean", "Pull X Gaussian Mean vs Silicon ECA Layer", 21, -0.5, 20.5);
711  for (int i = 1; i <= nx; i++) si_eca_pullX_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
712  si_eca_pullX_mean->GetYaxis()->SetTitle("Pull X Gaussian Mean");
713  TH1F* si_ecc_pullX_mean =
714  new TH1F("si_ecc_pullX_mean", "Pull X Gaussian Mean vs Silicon ECC Layer", 21, -0.5, 20.5);
715  for (int i = 1; i <= nx; i++) si_ecc_pullX_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
716  si_ecc_pullX_mean->GetYaxis()->SetTitle("Pull X Gaussian Mean");
717  TH1F* si_barrel_pullY_mean = new TH1F("si_barrel_pullY_mean", "Pull Y Gaussian Mean vs Silicon Barrel Layer", 12,
718  -0.5, 11.5);
719  for (int i = 1; i <= 12; i++) si_barrel_pullY_mean->GetXaxis()->SetBinLabel(i, siliconLayersBarrel[i - 1]);
720  si_barrel_pullY_mean->GetYaxis()->SetTitle("Pull Y Gaussian Mean");
721  TH1F* si_eca_pullY_mean =
722  new TH1F("si_eca_pullY_mean", "Pull Y Gaussian Mean vs Silicon ECA Layer", 21, -0.5, 20.5);
723  for (int i = 1; i <= nx; i++) si_eca_pullY_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
724  si_eca_pullY_mean->GetYaxis()->SetTitle("Pull Y Gaussian Mean");
725  TH1F* si_ecc_pullY_mean =
726  new TH1F("si_ecc_pullY_mean", "Pull Y Gaussian Mean vs Silicon ECC Layer", 21, -0.5, 20.5);
727  for (int i = 1; i <= nx; i++) si_ecc_pullY_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
728  si_ecc_pullY_mean->GetYaxis()->SetTitle("Pull Y Gaussian Mean");
729  fillGaussianMeanOrWidth(si_barrel_pullX, si_barrel_pullX_mean, -6.0, 6.0, 0);
730  fillGaussianMeanOrWidth(si_barrel_pullY, si_barrel_pullY_mean, -6.0, 6.0, 0);
731  fillGaussianMeanOrWidth(si_eca_pullX, si_eca_pullX_mean, -6.0, 6.0, 0);
732  fillGaussianMeanOrWidth(si_eca_pullY, si_eca_pullY_mean, -6.0, 6.0, 0);
733  fillGaussianMeanOrWidth(si_ecc_pullX, si_ecc_pullX_mean, -6.0, 6.0, 0);
734  fillGaussianMeanOrWidth(si_ecc_pullY, si_ecc_pullY_mean, -6.0, 6.0, 0);
735 
736  //residual mean for each layer in Silicon barrel and endcaps
737  TH1F* si_barrel_resX_mean = new TH1F("si_barrel_resX_mean", "Residual X Mean vs Silicon Barrel Layer", 12, -0.5,
738  11.5);
739  for (int i = 1; i <= 12; i++) si_barrel_resX_mean->GetXaxis()->SetBinLabel(i, siliconLayersBarrel[i - 1]);
740  si_barrel_resX_mean->GetYaxis()->SetTitle("Residual X Mean [mm]");
741  TH1F* si_eca_resX_mean = new TH1F("si_eca_resX_mean", "Residual X Mean vs Silicon ECA Layer", 21, -0.5, 20.5);
742  for (int i = 1; i <= nx; i++) si_eca_resX_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
743  si_eca_resX_mean->GetYaxis()->SetTitle("Residual X Mean [mm]");
744  TH1F* si_ecc_resX_mean = new TH1F("si_ecc_resX_mean", "Residual X Mean vs Silicon ECC Layer", 21, -0.5, 20.5);
745  for (int i = 1; i <= nx; i++) si_ecc_resX_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
746  si_ecc_resX_mean->GetYaxis()->SetTitle("Residual X Mean [mm]");
747  TH1F* si_barrel_resY_mean = new TH1F("si_barrel_resY_mean", "Residual Y Mean vs Silicon Barrel Layer", 12, -0.5,
748  11.5);
749  for (int i = 1; i <= 12; i++) si_barrel_resY_mean->GetXaxis()->SetBinLabel(i, siliconLayersBarrel[i - 1]);
750  si_barrel_resY_mean->GetYaxis()->SetTitle("Residual Y Mean [mm]");
751  TH1F* si_eca_resY_mean = new TH1F("si_eca_resY_mean", "Residual Y Mean vs Silicon ECA Layer", 21, -0.5, 20.5);
752  for (int i = 1; i <= nx; i++) si_eca_resY_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
753  si_eca_resY_mean->GetYaxis()->SetTitle("Residual Y Mean [mm]");
754  TH1F* si_ecc_resY_mean = new TH1F("si_ecc_resY_mean", "Residual Y Mean vs Silicon ECC Layer", 21, -0.5, 20.5);
755  for (int i = 1; i <= nx; i++) si_ecc_resY_mean->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
756  si_ecc_resY_mean->GetYaxis()->SetTitle("Residual Y Mean [mm]");
757  meanRMSProjections2D(si_barrel_resX, si_barrel_resX_mean, 2);
758  meanRMSProjections2D(si_barrel_resY, si_barrel_resY_mean, 2);
759  meanRMSProjections2D(si_eca_resX, si_eca_resX_mean, 2);
760  meanRMSProjections2D(si_eca_resY, si_eca_resY_mean, 2);
761  meanRMSProjections2D(si_ecc_resX, si_ecc_resX_mean, 2);
762  meanRMSProjections2D(si_ecc_resY, si_ecc_resY_mean, 2);
763 
764  //residual width for each layer in Silicon barrel and endcaps
765  TH1F* si_barrel_resX_rms =
766  new TH1F("si_barrel_resX_rms", "Residual X Width vs Silicon Barrel Layer", 12, -0.5, 11.5);
767  for (int i = 1; i <= 12; i++) si_barrel_resX_rms->GetXaxis()->SetBinLabel(i, siliconLayersBarrel[i - 1]);
768  si_barrel_resX_rms->GetYaxis()->SetTitle("Residual X Width [mm]");
769  TH1F* si_eca_resX_rms = new TH1F("si_eca_resX_rms", "Residual X Width vs Silicon ECA Layer", 21, -0.5, 20.5);
770  for (int i = 1; i <= nx; i++) si_eca_resX_rms->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
771  si_eca_resX_rms->GetYaxis()->SetTitle("Residual X Width [mm]");
772  TH1F* si_ecc_resX_rms = new TH1F("si_ecc_resX_rms", "Residual X Width vs Silicon ECC Layer", 21, -0.5, 20.5);
773  for (int i = 1; i <= nx; i++) si_ecc_resX_rms->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
774  si_ecc_resX_rms->GetYaxis()->SetTitle("Residual X Width [mm]");
775  TH1F* si_barrel_resY_rms =
776  new TH1F("si_barrel_resY_rms", "Residual Y Width vs Silicon Barrel Layer", 12, -0.5, 11.5);
777  for (int i = 1; i <= 12; i++) si_barrel_resY_rms->GetXaxis()->SetBinLabel(i, siliconLayersBarrel[i - 1]);
778  si_barrel_resY_rms->GetYaxis()->SetTitle("Residual Y Width [mm]");
779  TH1F* si_eca_resY_rms = new TH1F("si_eca_resY_rms", "Residual Y Width vs Silicon ECA Layer", 21, -0.5, 20.5);
780  for (int i = 1; i <= nx; i++) si_eca_resY_rms->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
781  si_eca_resY_rms->GetYaxis()->SetTitle("Residual Y Width [mm]");
782  TH1F* si_ecc_resY_rms = new TH1F("si_ecc_resY_rms", "Residual Y Width vs Silicon ECC Layer", 21, -0.5, 20.5);
783  for (int i = 1; i <= nx; i++) si_ecc_resY_rms->GetXaxis()->SetBinLabel(i, siliconLayers[i - 1]);
784  si_ecc_resY_rms->GetYaxis()->SetTitle("Residual Y Width [mm]");
785  meanRMSProjections2D(si_barrel_resX, si_barrel_resX_rms, 3);
786  meanRMSProjections2D(si_barrel_resY, si_barrel_resY_rms, 3);
787  meanRMSProjections2D(si_eca_resX, si_eca_resX_rms, 3);
788  meanRMSProjections2D(si_eca_resY, si_eca_resY_rms, 3);
789  meanRMSProjections2D(si_ecc_resX, si_ecc_resX_rms, 3);
790  meanRMSProjections2D(si_ecc_resY, si_ecc_resY_rms, 3);
791 
792  //x residual mean as a function of ring in the Pixel barrel
793 
794  TH1F* pix_b0_xresvsmodeta = new TH1F("pix_b0_xresvsmodeta", "X Residual Mean vs Eta-ID Pixel Barrel L0", 20, -10.5,
795  9.5);
796  pix_b0_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
797  pix_b0_xresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
798  TH1F* pix_b1_xresvsmodeta = new TH1F("pix_b1_xresvsmodeta", "X Residual Mean vs Eta-ID Pixel Barrel L1", 13, -6.5,
799  6.5);
800  pix_b1_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
801  pix_b1_xresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
802  TH1F* pix_b2_xresvsmodeta = new TH1F("pix_b2_xresvsmodeta", "X Residual Mean vs Eta-ID Pixel Barrel L2", 13, -6.5,
803  6.5);
804  pix_b2_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
805  pix_b2_xresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
806  TH1F* pix_b3_xresvsmodeta = new TH1F("pix_b3_xresvsmodeta", "X Residual Mean vs Eta-ID Pixel Barrel L3", 13, -6.5,
807  6.5);
808  pix_b3_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
809  pix_b3_xresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
810 
811  meanRMSProjections3D_XY(pix_b0_xresvsmodetaphi_3d, pix_b0_xresvsmodeta, 0, 2);
812  meanRMSProjections3D_XY(pix_b1_xresvsmodetaphi_3d, pix_b1_xresvsmodeta, 0, 2);
813  meanRMSProjections3D_XY(pix_b2_xresvsmodetaphi_3d, pix_b2_xresvsmodeta, 0, 2);
814  meanRMSProjections3D_XY(pix_b3_xresvsmodetaphi_3d, pix_b3_xresvsmodeta, 0, 2);
815  plots->Add(pix_b0_xresvsmodeta);
816  plots->Add(pix_b1_xresvsmodeta);
817  plots->Add(pix_b2_xresvsmodeta);
818  plots->Add(pix_b3_xresvsmodeta);
819  TH1F* pix_b_xresvsmodeta = combineHistos("pix_b_xresvsmodeta", "X Residual Mean vs (Modified) Eta-ID Pixel Barrel",
820  plots, 10);
821  pix_b_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
822  pix_b_xresvsmodeta->GetXaxis()->SetTitle("(Modified) Eta-ID");
823  plots->Clear();
824 
825  //x residual width as a function of ring in the Pixel barrel
826  TH1F* pix_b0_xresvsmodeta_width = new TH1F("pix_b0_xresvsmodeta_width",
827  "X Residual Width vs Eta-ID Pixel Barrel L0", 20, -10.5, 9.5);
828  pix_b0_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
829  pix_b0_xresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
830  TH1F* pix_b1_xresvsmodeta_width = new TH1F("pix_b1_xresvsmodeta_width",
831  "X Residual Width vs Eta-ID Pixel Barrel L1", 13, -6.5, 6.5);
832  pix_b1_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
833  pix_b1_xresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
834  TH1F* pix_b2_xresvsmodeta_width = new TH1F("pix_b2_xresvsmodeta_width",
835  "X Residual Width vs Eta-ID Pixel Barrel L2", 13, -6.5, 6.5);
836  pix_b2_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
837  pix_b2_xresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
838  TH1F* pix_b3_xresvsmodeta_width = new TH1F("pix_b3_xresvsmodeta_width",
839  "X Residual Width vs Eta-ID Pixel Barrel L3", 13, -6.5, 6.5);
840  pix_b3_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
841  pix_b3_xresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
842  meanRMSProjections3D_XY(pix_b0_xresvsmodetaphi_3d, pix_b0_xresvsmodeta_width, 0, 3);
843  meanRMSProjections3D_XY(pix_b1_xresvsmodetaphi_3d, pix_b1_xresvsmodeta_width, 0, 3);
844  meanRMSProjections3D_XY(pix_b2_xresvsmodetaphi_3d, pix_b2_xresvsmodeta_width, 0, 3);
845  meanRMSProjections3D_XY(pix_b3_xresvsmodetaphi_3d, pix_b3_xresvsmodeta_width, 0, 3);
846  plots->Add(pix_b0_xresvsmodeta_width);
847  plots->Add(pix_b1_xresvsmodeta_width);
848  plots->Add(pix_b2_xresvsmodeta_width);
849  plots->Add(pix_b3_xresvsmodeta_width);
850  TH1F* pix_b_xresvsmodeta_width = combineHistos("pix_b_xresvsmodeta_width",
851  "X Residual Width vs (Modified) Eta-ID Pixel Barrel", plots, 10);
852  pix_b_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
853  pix_b_xresvsmodeta_width->GetXaxis()->SetTitle("(Modified) Eta-ID");
854  plots->Clear();
855 
856  //y residual mean as a function of ring in the Pixel barrel
857  TH1F* pix_b0_yresvsmodeta = new TH1F("pix_b0_yresvsmodeta", "Y Residual Mean vs Eta-ID Pixel Barrel L0", 20, -10.5,
858  9.5);
859  pix_b0_yresvsmodeta->GetYaxis()->SetTitle("Mean Residual Y [mm]");
860  pix_b0_yresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
861  TH1F* pix_b1_yresvsmodeta = new TH1F("pix_b1_yresvsmodeta", "Y Residual Mean vs Eta-ID Pixel Barrel L1", 13, -6.5,
862  6.5);
863  pix_b1_yresvsmodeta->GetYaxis()->SetTitle("Mean Residual Y [mm]");
864  pix_b1_yresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
865  TH1F* pix_b2_yresvsmodeta = new TH1F("pix_b2_yresvsmodeta", "Y Residual Mean vs Eta-ID Pixel Barrel L2", 13, -6.5,
866  6.5);
867  pix_b2_yresvsmodeta->GetYaxis()->SetTitle("Mean Residual Y [mm]");
868  pix_b2_yresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
869  TH1F* pix_b3_yresvsmodeta = new TH1F("pix_b3_yresvsmodeta", "Y Residual Mean vs Eta-ID Pixel Barrel L2", 13, -6.5,
870  6.5);
871  pix_b3_yresvsmodeta->GetYaxis()->SetTitle("Mean Residual Y [mm]");
872  pix_b3_yresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
873  meanRMSProjections3D_XY(pix_b0_yresvsmodetaphi_3d, pix_b0_yresvsmodeta, 0, 2);
874  meanRMSProjections3D_XY(pix_b1_yresvsmodetaphi_3d, pix_b1_yresvsmodeta, 0, 2);
875  meanRMSProjections3D_XY(pix_b2_yresvsmodetaphi_3d, pix_b2_yresvsmodeta, 0, 2);
876  meanRMSProjections3D_XY(pix_b3_yresvsmodetaphi_3d, pix_b3_yresvsmodeta, 0, 2);
877  plots->Add(pix_b0_yresvsmodeta);
878  plots->Add(pix_b1_yresvsmodeta);
879  plots->Add(pix_b2_yresvsmodeta);
880  plots->Add(pix_b3_yresvsmodeta);
881  TH1F* pix_b_yresvsmodeta = combineHistos("pix_b_yresvsmodeta", "Y Residual Mean vs (Modified) Eta-ID Pixel Barrel",
882  plots, 10);
883  pix_b_yresvsmodeta->GetYaxis()->SetTitle("Mean Residual Y [mm]");
884  pix_b_yresvsmodeta->GetXaxis()->SetTitle("(Modified) Eta-ID");
885  plots->Clear();
886 
887  //y residual width as a function of ring in the Pixel barrel
888  TH1F* pix_b0_yresvsmodeta_width = new TH1F("pix_b0_yresvsmodeta_width",
889  "Y Residual Width vs Eta-ID Pixel Barrel L0", 20, -10.5, 9.5);
890  pix_b0_yresvsmodeta_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
891  pix_b0_yresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
892  TH1F* pix_b1_yresvsmodeta_width = new TH1F("pix_b1_yresvsmodeta_width",
893  "Y Residual Width vs Eta-ID Pixel Barrel L1", 13, -6.5, 6.5);
894  pix_b1_yresvsmodeta_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
895  pix_b1_yresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
896  TH1F* pix_b2_yresvsmodeta_width = new TH1F("pix_b2_yresvsmodeta_width",
897  "Y Residual Width vs Eta-ID Pixel Barrel L2", 13, -6.5, 6.5);
898  pix_b2_yresvsmodeta_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
899  pix_b2_yresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
900  TH1F* pix_b3_yresvsmodeta_width = new TH1F("pix_b3_yresvsmodeta_width",
901  "Y Residual Width vs Eta-ID Pixel Barrel L2", 13, -6.5, 6.5);
902  pix_b3_yresvsmodeta_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
903  pix_b3_yresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
904 
905  meanRMSProjections3D_XY(pix_b0_yresvsmodetaphi_3d, pix_b0_yresvsmodeta_width, 0, 3);
906  meanRMSProjections3D_XY(pix_b1_yresvsmodetaphi_3d, pix_b1_yresvsmodeta_width, 0, 3);
907  meanRMSProjections3D_XY(pix_b2_yresvsmodetaphi_3d, pix_b2_yresvsmodeta_width, 0, 3);
908  meanRMSProjections3D_XY(pix_b3_yresvsmodetaphi_3d, pix_b3_yresvsmodeta_width, 0, 3);
909  plots->Add(pix_b0_yresvsmodeta_width);
910  plots->Add(pix_b1_yresvsmodeta_width);
911  plots->Add(pix_b2_yresvsmodeta_width);
912  plots->Add(pix_b3_yresvsmodeta_width);
913 
914  TH1F* pix_b_yresvsmodeta_width = combineHistos("pix_b_yresvsmodeta_width",
915  "Y Residual Width vs (Modified) Eta-ID Pixel Barrel", plots, 10);
916  pix_b_yresvsmodeta_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
917  pix_b_yresvsmodeta_width->GetXaxis()->SetTitle("(Modified) Eta-ID");
918  plots->Clear();
919 
920  //x residual mean as a function of stave in the Pixel barrel
921 
922  TH1F* pix_b0_xresvsmodphi = new TH1F("pix_b0_xresvsmodphi", "X Residual Mean vs Phi-ID Pixel Barrel L0", 14, 0, 14);
923  pix_b0_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
924  pix_b0_xresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
925  TH1F* pix_b1_xresvsmodphi =
926  new TH1F("pix_b1_xresvsmodphi", "X Residual Mean vs Phi-ID Pixel Barrel L0", 22, -0, 22);
927  pix_b1_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
928  pix_b1_xresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
929  TH1F* pix_b2_xresvsmodphi = new TH1F("pix_b2_xresvsmodphi", "X Residual Mean vs Phi-ID Pixel Barrel L1", 38, 0, 38);
930  pix_b2_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
931  pix_b2_xresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
932  TH1F* pix_b3_xresvsmodphi = new TH1F("pix_b3_xresvsmodphi", "X Residual Mean vs Phi-ID Pixel Barrel L2", 52, 0, 52);
933  pix_b3_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
934  pix_b3_xresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
935 
936 
937  meanRMSProjections3D_XY(pix_b0_xresvsmodetaphi_3d, pix_b0_xresvsmodphi, 1, 2);
938  meanRMSProjections3D_XY(pix_b1_xresvsmodetaphi_3d, pix_b1_xresvsmodphi, 1, 2);
939  meanRMSProjections3D_XY(pix_b2_xresvsmodetaphi_3d, pix_b2_xresvsmodphi, 1, 2);
940  meanRMSProjections3D_XY(pix_b3_xresvsmodetaphi_3d, pix_b3_xresvsmodphi, 1, 2);
941 
942  plots->Add(pix_b0_xresvsmodphi);
943  plots->Add(pix_b1_xresvsmodphi);
944  plots->Add(pix_b2_xresvsmodphi);
945  plots->Add(pix_b3_xresvsmodphi);
946  TH1F* pix_b_xresvsmodphi = combineHistos("pix_b_xresvsmodphi", "X Residual Mean vs (Modified) Phi-ID Pixel Barrel",
947  plots, 10);
948  pix_b_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
949  pix_b_xresvsmodphi->GetXaxis()->SetTitle("(Modified) Phi-ID");
950  plots->Clear();
951 
952  //x residual width as a function of stave in the Pixel barrel
953  TH1F* pix_b0_xresvsmodphi_width = new TH1F("pix_b0_xresvsmodphi_width",
954  "X Residual Width vs Phi-ID Pixel Barrel L0", 14, 0, 14);
955  pix_b0_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
956  pix_b0_xresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
957  TH1F* pix_b1_xresvsmodphi_width = new TH1F("pix_b1_xresvsmodphi_width",
958  "X Residual Width vs Phi-ID Pixel Barrel L0", 22, 0., 22);
959  pix_b1_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
960  pix_b1_xresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
961  TH1F* pix_b2_xresvsmodphi_width = new TH1F("pix_b2_xresvsmodphi_width",
962  "X Residual Width vs Phi-ID Pixel Barrel L1", 38, 0, 38);
963  pix_b2_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
964  pix_b2_xresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
965  TH1F* pix_b3_xresvsmodphi_width = new TH1F("pix_b3_xresvsmodphi_width",
966  "X Residual Width vs Phi-ID Pixel Barrel L2", 52, 0, 52);
967  pix_b3_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
968  pix_b3_xresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
969  meanRMSProjections3D_XY(pix_b0_xresvsmodetaphi_3d, pix_b0_xresvsmodphi_width, 1, 3);
970  meanRMSProjections3D_XY(pix_b1_xresvsmodetaphi_3d, pix_b1_xresvsmodphi_width, 1, 3);
971  meanRMSProjections3D_XY(pix_b2_xresvsmodetaphi_3d, pix_b2_xresvsmodphi_width, 1, 3);
972  meanRMSProjections3D_XY(pix_b3_xresvsmodetaphi_3d, pix_b3_xresvsmodphi_width, 1, 3);
973  plots->Add(pix_b0_xresvsmodphi_width);
974  plots->Add(pix_b1_xresvsmodphi_width);
975  plots->Add(pix_b2_xresvsmodphi_width);
976  plots->Add(pix_b3_xresvsmodphi_width);
977  TH1F* pix_b_xresvsmodphi_width = combineHistos("pix_b_xresvsmodphi_width",
978  "X Residual Width vs (Modified) Phi-ID Pixel Barrel", plots, 10);
979  pix_b_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
980  pix_b_xresvsmodphi_width->GetXaxis()->SetTitle("(Modified) Phi-ID");
981  plots->Clear();
982 
983  //y residual mean as a function of stave in the Pixel barrel
984  TH1F* pix_b0_yresvsmodphi = new TH1F("pix_b0_yresvsmodphi", "Y Residual Mean vs Phi-ID Pixel Barrel L0", 14, 0, 14);
985  pix_b0_yresvsmodphi->GetYaxis()->SetTitle("Mean Residual Y [mm]");
986  pix_b0_yresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
987  TH1F* pix_b1_yresvsmodphi = new TH1F("pix_b1_yresvsmodphi", "Y Residual Mean vs Phi-ID Pixel Barrel L0", 22, 0, 22);
988  pix_b1_yresvsmodphi->GetYaxis()->SetTitle("Mean Residual Y [mm]");
989  pix_b1_yresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
990  TH1F* pix_b2_yresvsmodphi = new TH1F("pix_b2_yresvsmodphi", "Y Residual Mean vs Phi-ID Pixel Barrel L1", 38, 0, 38);
991  pix_b2_yresvsmodphi->GetYaxis()->SetTitle("Mean Residual Y [mm]");
992  pix_b2_yresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
993  TH1F* pix_b3_yresvsmodphi = new TH1F("pix_b3_yresvsmodphi", "Y Residual Mean vs Phi-ID Pixel Barrel L2", 52, 0, 52);
994  pix_b3_yresvsmodphi->GetYaxis()->SetTitle("Mean Residual Y [mm]");
995  pix_b3_yresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
996  meanRMSProjections3D_XY(pix_b0_yresvsmodetaphi_3d, pix_b0_yresvsmodphi, 1, 2);
997  meanRMSProjections3D_XY(pix_b1_yresvsmodetaphi_3d, pix_b1_yresvsmodphi, 1, 2);
998  meanRMSProjections3D_XY(pix_b2_yresvsmodetaphi_3d, pix_b2_yresvsmodphi, 1, 2);
999  meanRMSProjections3D_XY(pix_b3_yresvsmodetaphi_3d, pix_b3_yresvsmodphi, 1, 2);
1000  plots->Add(pix_b0_yresvsmodphi);
1001  plots->Add(pix_b1_yresvsmodphi);
1002  plots->Add(pix_b2_yresvsmodphi);
1003  plots->Add(pix_b3_yresvsmodphi);
1004 
1005  TH1F* pix_b_yresvsmodphi = combineHistos("pix_b_yresvsmodphi", "Y Residual Mean vs (Modified) Phi-ID Pixel Barrel",
1006  plots, 10);
1007  pix_b_yresvsmodphi->GetYaxis()->SetTitle("Mean Residual Y [mm]");
1008  pix_b_yresvsmodphi->GetXaxis()->SetTitle("(Modified) Phi-ID");
1009  plots->Clear();
1010 
1011  //y residual width as a function of stave in the Pixel barrel
1012  TH1F* pix_b0_yresvsmodphi_width = new TH1F("pix_b0_yresvsmodphi_width",
1013  "Y Residual Width vs Phi-ID Pixel Barrel L0", 14, 0, 14);
1014  pix_b0_yresvsmodphi_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
1015  pix_b0_yresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
1016  TH1F* pix_b1_yresvsmodphi_width = new TH1F("pix_b1_yresvsmodphi_width",
1017  "Y Residual Width vs Phi-ID Pixel Barrel L0", 22, -0, 22);
1018  pix_b1_yresvsmodphi_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
1019  pix_b1_yresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
1020  TH1F* pix_b2_yresvsmodphi_width = new TH1F("pix_b2_yresvsmodphi_width",
1021  "Y Residual Width vs Phi-ID Pixel Barrel L1", 38, 0, 38);
1022  pix_b2_yresvsmodphi_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
1023  pix_b2_yresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
1024  TH1F* pix_b3_yresvsmodphi_width = new TH1F("pix_b3_yresvsmodphi_width",
1025  "Y Residual Width vs Phi-ID Pixel Barrel L2", 52, 0, 52);
1026  pix_b3_yresvsmodphi_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
1027  pix_b3_yresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
1028  meanRMSProjections3D_XY(pix_b0_yresvsmodetaphi_3d, pix_b0_yresvsmodphi_width, 1, 3);
1029  meanRMSProjections3D_XY(pix_b1_yresvsmodetaphi_3d, pix_b1_yresvsmodphi_width, 1, 3);
1030  meanRMSProjections3D_XY(pix_b2_yresvsmodetaphi_3d, pix_b2_yresvsmodphi_width, 1, 3);
1031  meanRMSProjections3D_XY(pix_b3_yresvsmodetaphi_3d, pix_b3_yresvsmodphi_width, 1, 3);
1032  plots->Add(pix_b0_yresvsmodphi_width);
1033  plots->Add(pix_b1_yresvsmodphi_width);
1034  plots->Add(pix_b2_yresvsmodphi_width);
1035  plots->Add(pix_b3_yresvsmodphi_width);
1036  TH1F* pix_b_yresvsmodphi_width = combineHistos("pix_b_yresvsmodphi_width",
1037  "Y Residual Width vs (Modified) Phi-ID Pixel Barrel", plots, 10);
1038  pix_b_yresvsmodphi_width->GetYaxis()->SetTitle("Width Residual Y [mm]");
1039  pix_b_yresvsmodphi_width->GetXaxis()->SetTitle("(Modified) Phi-ID");
1040  plots->Clear();
1041 
1042  //x residual mean as a function of ring in the SCT barrel
1043  TH1F* sct_b0_xresvsmodeta = new TH1F("sct_b0_xresvsmodeta", "X Residual Mean vs Eta-ID SCT Barrel L0", 13, -0.5,
1044  12.5);
1045  pix_b0_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
1046  pix_b0_xresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
1047  TH1F* sct_b1_xresvsmodeta = new TH1F("sct_b1_xresvsmodeta", "X Residual Mean vs Eta-ID SCT Barrel L1", 13, -0.5,
1048  12.5);
1049  sct_b1_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
1050  sct_b1_xresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
1051  TH1F* sct_b2_xresvsmodeta = new TH1F("sct_b2_xresvsmodeta", "X Residual Mean vs Eta-ID SCT Barrel L2", 13, -0.5,
1052  12.5);
1053  sct_b2_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
1054  sct_b2_xresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
1055  TH1F* sct_b3_xresvsmodeta = new TH1F("sct_b3_xresvsmodeta", "X Residual Mean vs Eta-ID SCT Barrel L3", 13, -0.5,
1056  12.5);
1057  sct_b3_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
1058  sct_b3_xresvsmodeta->GetXaxis()->SetTitle("Module Eta-ID");
1059  meanRMSProjections3D_XY(sct_b0_xresvsmodetaphi_3d, sct_b0_xresvsmodeta, 0, 2);
1060  meanRMSProjections3D_XY(sct_b1_xresvsmodetaphi_3d, sct_b1_xresvsmodeta, 0, 2);
1061  meanRMSProjections3D_XY(sct_b2_xresvsmodetaphi_3d, sct_b2_xresvsmodeta, 0, 2);
1062  meanRMSProjections3D_XY(sct_b3_xresvsmodetaphi_3d, sct_b3_xresvsmodeta, 0, 2);
1063  plots->Add(sct_b0_xresvsmodeta);
1064  plots->Add(sct_b1_xresvsmodeta);
1065  plots->Add(sct_b2_xresvsmodeta);
1066  plots->Add(sct_b3_xresvsmodeta);
1067  TH1F* sct_b_xresvsmodeta = combineHistos("sct_b_xresvsmodeta", "X Residual Mean vs (Modified) Eta-ID SCT Barrel",
1068  plots, 10);
1069  sct_b_xresvsmodeta->GetYaxis()->SetTitle("Mean Residual X [mm]");
1070  sct_b_xresvsmodeta->GetXaxis()->SetTitle("(Modified) Eta-ID");
1071  plots->Clear();
1072 
1073  //x residual width as a function of ring in the SCT barrel
1074  TH1F* sct_b0_xresvsmodeta_width = new TH1F("sct_b0_xresvsmodeta_width", "X Residual Width vs Eta-ID SCT Barrel L0",
1075  13, -0.5, 12.5);
1076  pix_b0_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1077  pix_b0_xresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1078  TH1F* sct_b1_xresvsmodeta_width = new TH1F("sct_b1_xresvsmodeta_width", "X Residual Width vs Eta-ID SCT Barrel L1",
1079  13, -0.5, 12.5);
1080  sct_b1_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1081  sct_b1_xresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1082  TH1F* sct_b2_xresvsmodeta_width = new TH1F("sct_b2_xresvsmodeta_width", "X Residual Width vs Eta-ID SCT Barrel L2",
1083  13, -0.5, 12.5);
1084  sct_b2_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1085  sct_b2_xresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1086  TH1F* sct_b3_xresvsmodeta_width = new TH1F("sct_b3_xresvsmodeta_width", "X Residual Width vs Eta-ID SCT Barrel L3",
1087  13, -0.5, 12.5);
1088  sct_b3_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1089  sct_b3_xresvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1090  meanRMSProjections3D_XY(sct_b0_xresvsmodetaphi_3d, sct_b0_xresvsmodeta_width, 0, 3);
1091  meanRMSProjections3D_XY(sct_b1_xresvsmodetaphi_3d, sct_b1_xresvsmodeta_width, 0, 3);
1092  meanRMSProjections3D_XY(sct_b2_xresvsmodetaphi_3d, sct_b2_xresvsmodeta_width, 0, 3);
1093  meanRMSProjections3D_XY(sct_b3_xresvsmodetaphi_3d, sct_b3_xresvsmodeta_width, 0, 3);
1094  plots->Add(sct_b0_xresvsmodeta_width);
1095  plots->Add(sct_b1_xresvsmodeta_width);
1096  plots->Add(sct_b2_xresvsmodeta_width);
1097  plots->Add(sct_b3_xresvsmodeta_width);
1098  TH1F* sct_b_xresvsmodeta_width = combineHistos("sct_b_xresvsmodeta_width",
1099  "X Residual Width vs (Modified) Eta-ID SCT Barrel", plots, 10);
1100  sct_b_xresvsmodeta_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1101  sct_b_xresvsmodeta_width->GetXaxis()->SetTitle("(Modified) Eta-ID");
1102  plots->Clear();
1103 
1104  //x residual mean as a function of stave in the SCT barrel
1105  TH1F* sct_b0_xresvsmodphi = new TH1F("sct_b0_xresvsmodphi", "X Residual Mean vs Phi-ID SCT Barrel L0", 32, -0.5,
1106  31.5);
1107  pix_b0_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1108  pix_b0_xresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
1109  TH1F* sct_b1_xresvsmodphi = new TH1F("sct_b1_xresvsmodphi", "X Residual Mean vs Phi-ID SCT Barrel L1", 40, -0.5,
1110  39.5);
1111  sct_b1_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1112  sct_b1_xresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
1113  TH1F* sct_b2_xresvsmodphi = new TH1F("sct_b2_xresvsmodphi", "X Residual Mean vs Phi-ID SCT Barrel L2", 48, -0.5,
1114  47.5);
1115  sct_b2_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1116  sct_b2_xresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
1117  TH1F* sct_b3_xresvsmodphi = new TH1F("sct_b3_xresvsmodphi", "X Residual Mean vs Phi-ID SCT Barrel L3", 56, -0.5,
1118  55.5);
1119  sct_b3_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1120  sct_b3_xresvsmodphi->GetXaxis()->SetTitle("Module Phi-ID");
1121  meanRMSProjections3D_XY(sct_b0_xresvsmodetaphi_3d, sct_b0_xresvsmodphi, 1, 2);
1122  meanRMSProjections3D_XY(sct_b1_xresvsmodetaphi_3d, sct_b1_xresvsmodphi, 1, 2);
1123  meanRMSProjections3D_XY(sct_b2_xresvsmodetaphi_3d, sct_b2_xresvsmodphi, 1, 2);
1124  meanRMSProjections3D_XY(sct_b3_xresvsmodetaphi_3d, sct_b3_xresvsmodphi, 1, 2);
1125  plots->Add(sct_b0_xresvsmodphi);
1126  plots->Add(sct_b1_xresvsmodphi);
1127  plots->Add(sct_b2_xresvsmodphi);
1128  plots->Add(sct_b3_xresvsmodphi);
1129  TH1F* sct_b_xresvsmodphi = combineHistos("sct_b_xresvsmodphi", "X Residual Mean vs (Modified) Phi-ID SCT Barrel",
1130  plots, 10);
1131  sct_b_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1132  sct_b_xresvsmodphi->GetXaxis()->SetTitle("(Modified) Phi-ID");
1133  plots->Clear();
1134 
1135  //x residual width as a function of stave in the SCT barrel
1136  TH1F* sct_b0_xresvsmodphi_width = new TH1F("sct_b0_xresvsmodphi_width", "X Residual Width vs Phi-ID SCT Barrel L0",
1137  32, -0.5, 31.5);
1138  pix_b0_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1139  pix_b0_xresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
1140  TH1F* sct_b1_xresvsmodphi_width = new TH1F("sct_b1_xresvsmodphi_width", "X Residual Width vs Phi-ID SCT Barrel L1",
1141  40, -0.5, 39.5);
1142  sct_b1_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1143  sct_b1_xresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
1144  TH1F* sct_b2_xresvsmodphi_width = new TH1F("sct_b2_xresvsmodphi_width", "X Residual Width vs Phi-ID SCT Barrel L2",
1145  48, -0.5, 47.5);
1146  sct_b2_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1147  sct_b2_xresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
1148  TH1F* sct_b3_xresvsmodphi_width = new TH1F("sct_b3_xresvsmodphi_width", "X Residual Width vs Phi-ID SCT Barrel L3",
1149  56, -0.5, 55.5);
1150  sct_b3_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1151  sct_b3_xresvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
1152  meanRMSProjections3D_XY(sct_b0_xresvsmodetaphi_3d, sct_b0_xresvsmodphi_width, 1, 3);
1153  meanRMSProjections3D_XY(sct_b1_xresvsmodetaphi_3d, sct_b1_xresvsmodphi_width, 1, 3);
1154  meanRMSProjections3D_XY(sct_b2_xresvsmodetaphi_3d, sct_b2_xresvsmodphi_width, 1, 3);
1155  meanRMSProjections3D_XY(sct_b3_xresvsmodetaphi_3d, sct_b3_xresvsmodphi_width, 1, 3);
1156  plots->Add(sct_b0_xresvsmodphi_width);
1157  plots->Add(sct_b1_xresvsmodphi_width);
1158  plots->Add(sct_b2_xresvsmodphi_width);
1159  plots->Add(sct_b3_xresvsmodphi_width);
1160  TH1F* sct_b_xresvsmodphi_width = combineHistos("sct_b_xresvsmodphi_width",
1161  "X Residual Width vs (Modified) Phi-ID SCT Barrel", plots, 10);
1162  sct_b_xresvsmodphi_width->GetYaxis()->SetTitle("Width Residual X [mm]");
1163  sct_b_xresvsmodphi_width->GetXaxis()->SetTitle("(Modified) Phi-ID");
1164  plots->Clear();
1165 
1166  //residual mean as function of module eta/phi in Silicon endcaps
1167  TH1F* pix_eca_xresvsmodphi = new TH1F("pix_eca_xresvsmodphi",
1168  "X Residual Mean vs (Modified) Module Phi Pixel Endcap A", 165, 0, 165);
1169  pix_eca_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1170  pix_eca_xresvsmodphi->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
1171  meanRMSProjections2D(pix_eca_xresvsmodphi_2d, pix_eca_xresvsmodphi, 2);
1172  TH1F* pix_eca_yresvsmodphi = new TH1F("pix_eca_yresvsmodphi",
1173  "Y Residual Mean vs (Modified) Module Phi Pixel Endcap A", 165, 0, 165);
1174  pix_eca_yresvsmodphi->GetYaxis()->SetTitle("Mean Residual Y [mm]");
1175  pix_eca_yresvsmodphi->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
1176  meanRMSProjections2D(pix_eca_yresvsmodphi_2d, pix_eca_yresvsmodphi, 2);
1177  TH1F* pix_ecc_xresvsmodphi = new TH1F("pix_ecc_xresvsmodphi",
1178  "X Residual Mean vs (Modified) Module Phi Pixel Endcap C", 165, 0, 165);
1179  pix_ecc_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1180  pix_ecc_xresvsmodphi->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
1181  meanRMSProjections2D(pix_ecc_xresvsmodphi_2d, pix_ecc_xresvsmodphi, 2);
1182  TH1F* pix_ecc_yresvsmodphi = new TH1F("pix_ecc_yresvsmodphi",
1183  "Y Residual Mean vs (Modified) Module Phi Pixel Endcap C", 165, 0, 165);
1184  pix_ecc_yresvsmodphi->GetYaxis()->SetTitle("Mean Residual Y [mm]");
1185  pix_ecc_yresvsmodphi->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
1186  meanRMSProjections2D(pix_ecc_yresvsmodphi_2d, pix_ecc_yresvsmodphi, 2);
1187  TH1F* sct_eca_xresvsmodphi = new TH1F("sct_eca_xresvsmodphi",
1188  "X Residual Mean vs (Modified) Module Phi SCT Endcap A", 558, 0, 558);
1189  sct_eca_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1190  sct_eca_xresvsmodphi->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
1191  meanRMSProjections2D(sct_eca_xresvsmodphi_2d, sct_eca_xresvsmodphi, 2);
1192  TH1F* sct_ecc_xresvsmodphi = new TH1F("sct_ecc_xresvsmodphi",
1193  "X Residual Mean vs (Modified) Module Phi SCT Endcap C", 558, 0, 558);
1194  sct_ecc_xresvsmodphi->GetYaxis()->SetTitle("Mean Residual X [mm]");
1195  sct_ecc_xresvsmodphi->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
1196  meanRMSProjections2D(sct_ecc_xresvsmodphi_2d, sct_ecc_xresvsmodphi, 2);
1197 
1198 
1199  //2-d residual map histograms - pixel barrel residual mean
1200  TH2F* pix_b0_xresvsmodetaphi_mean = new TH2F("pix_b0_xresvsmodetaphi_mean",
1201  "X Residual Mean vs Module Eta-Phi-ID Pixel Barrel L0", 20, -10.5, 9.5,
1202  14, 0, 14);
1203  pix_b0_xresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1204  pix_b0_xresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1205  TH2F* pix_b1_xresvsmodetaphi_mean = new TH2F("pix_b1_xresvsmodetaphi_mean",
1206  "X Residual Mean vs Module Eta-Phi-ID Pixel Barrel L1", 13, -6.5, 6.5,
1207  22, -0.5, 21.5);
1208  pix_b1_xresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1209  pix_b1_xresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1210  TH2F* pix_b2_xresvsmodetaphi_mean = new TH2F("pix_b2_xresvsmodetaphi_mean",
1211  "X Residual Mean vs Module Eta-Phi-ID Pixel Barrel L2", 13, -6.5, 6.5,
1212  38, -0.5, 37.5);
1213  pix_b2_xresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1214  pix_b2_xresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1215  TH2F* pix_b3_xresvsmodetaphi_mean = new TH2F("pix_b3_xresvsmodetaphi_mean",
1216  "X Residual Mean vs Module Eta-Phi-ID Pixel Barrel L3", 13, -6.5, 6.5,
1217  52, -0.5, 51.5);
1218  pix_b3_xresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1219  pix_b3_xresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1220 
1221 
1222 
1223  TH2F* pix_b0_yresvsmodetaphi_mean = new TH2F("pix_b0_yresvsmodetaphi_mean",
1224  "Y Residual Mean vs Module Eta-Phi-ID Pixel Barrel L0", 20, -10.5, 9.5,
1225  14, 0, 14);
1226  pix_b0_yresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1227  pix_b0_yresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1228  TH2F* pix_b1_yresvsmodetaphi_mean = new TH2F("pix_b1_yresvsmodetaphi_mean",
1229  "Y Residual Mean vs Module Eta-Phi-ID Pixel Barrel L1", 13, -6.5, 6.5,
1230  22, -0.5, 21.5);
1231  pix_b1_yresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1232  pix_b1_yresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1233  TH2F* pix_b2_yresvsmodetaphi_mean = new TH2F("pix_b2_yresvsmodetaphi_mean",
1234  "Y Residual Mean vs Module Eta-Phi-ID Pixel Barrel L2", 13, -6.5, 6.5,
1235  38, -0.5, 37.5);
1236  pix_b2_yresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1237  pix_b2_yresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1238  TH2F* pix_b3_yresvsmodetaphi_mean = new TH2F("pix_b3_yresvsmodetaphi_mean",
1239  "Y Residual Mean vs Module Eta-Phi-ID Pixel Barrel L3", 13, -6.5, 6.5,
1240  52, -0.5, 51.5);
1241  pix_b3_yresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1242  pix_b3_yresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1243  meanRMSProjections3D(pix_b0_xresvsmodetaphi_3d, pix_b0_xresvsmodetaphi_mean, 2);
1244  meanRMSProjections3D(pix_b1_xresvsmodetaphi_3d, pix_b1_xresvsmodetaphi_mean, 2);
1245  meanRMSProjections3D(pix_b2_xresvsmodetaphi_3d, pix_b2_xresvsmodetaphi_mean, 2);
1246  meanRMSProjections3D(pix_b3_xresvsmodetaphi_3d, pix_b3_xresvsmodetaphi_mean, 2);
1247  meanRMSProjections3D(pix_b0_yresvsmodetaphi_3d, pix_b0_yresvsmodetaphi_mean, 2);
1248  meanRMSProjections3D(pix_b1_yresvsmodetaphi_3d, pix_b1_yresvsmodetaphi_mean, 2);
1249  meanRMSProjections3D(pix_b2_yresvsmodetaphi_3d, pix_b2_yresvsmodetaphi_mean, 2);
1250  meanRMSProjections3D(pix_b3_yresvsmodetaphi_3d, pix_b3_yresvsmodetaphi_mean, 2);
1251 
1252  //2-d residual map histograms - pixel barrel residual width
1253  TH2F* pix_b0_xresvsmodetaphi_rms = new TH2F("pix_b0_xresvsmodetaphi_rms",
1254  "X Residual Width vs Module Eta-Phi-ID Pixel Barrel L0", 20, -10.5, 9.5,
1255  14, 0, 14);
1256  pix_b0_xresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1257  pix_b0_xresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1258  TH2F* pix_b1_xresvsmodetaphi_rms = new TH2F("pix_b1_xresvsmodetaphi_rms",
1259  "X Residual Width vs Module Eta-Phi-ID Pixel Barrel L1", 13, -6.5, 6.5,
1260  22, -0.5, 21.5);
1261  pix_b1_xresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1262  pix_b1_xresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1263  TH2F* pix_b2_xresvsmodetaphi_rms = new TH2F("pix_b2_xresvsmodetaphi_rms",
1264  "X Residual Width vs Module Eta-Phi-ID Pixel Barrel L2", 13, -6.5, 6.5,
1265  38, -0.5, 37.5);
1266  pix_b2_xresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1267  pix_b2_xresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1268  TH2F* pix_b3_xresvsmodetaphi_rms = new TH2F("pix_b3_xresvsmodetaphi_rms",
1269  "X Residual Width vs Module Eta-Phi-ID Pixel Barrel L3", 13, -6.5, 6.5,
1270  52, -0.5, 51.5);
1271  pix_b3_xresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1272  pix_b3_xresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1273  TH2F* pix_b0_yresvsmodetaphi_rms = new TH2F("pix_b0_yresvsmodetaphi_rms",
1274  "Y Residual Width vs Module Eta-Phi-ID Pixel Barrel L0", 20, -10.5, 9.5,
1275  14, 0, 14);
1276  pix_b0_yresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1277  pix_b0_yresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1278  TH2F* pix_b1_yresvsmodetaphi_rms = new TH2F("pix_b1_yresvsmodetaphi_rms",
1279  "Y Residual Width vs Module Eta-Phi-ID Pixel Barrel L1", 13, -6.5, 6.5,
1280  22, -0.5, 21.5);
1281  pix_b1_yresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1282  pix_b1_yresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1283  TH2F* pix_b2_yresvsmodetaphi_rms = new TH2F("pix_b2_yresvsmodetaphi_rms",
1284  "Y Residual Width vs Module Eta-Phi-ID Pixel Barrel L2", 13, -6.5, 6.5,
1285  38, -0.5, 37.5);
1286  pix_b2_yresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1287  pix_b2_yresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1288  TH2F* pix_b3_yresvsmodetaphi_rms = new TH2F("pix_b3_yresvsmodetaphi_rms",
1289  "Y Residual Width vs Module Eta-Phi-ID Pixel Barrel L3", 13, -6.5, 6.5,
1290  52, -0.5, 51.5);
1291  pix_b3_yresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1292  pix_b3_yresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1293  meanRMSProjections3D(pix_b0_xresvsmodetaphi_3d, pix_b0_xresvsmodetaphi_rms, 3);
1294  meanRMSProjections3D(pix_b1_xresvsmodetaphi_3d, pix_b1_xresvsmodetaphi_rms, 3);
1295  meanRMSProjections3D(pix_b2_xresvsmodetaphi_3d, pix_b2_xresvsmodetaphi_rms, 3);
1296  meanRMSProjections3D(pix_b3_xresvsmodetaphi_3d, pix_b3_xresvsmodetaphi_rms, 3);
1297  meanRMSProjections3D(pix_b0_yresvsmodetaphi_3d, pix_b0_yresvsmodetaphi_rms, 3);
1298  meanRMSProjections3D(pix_b1_yresvsmodetaphi_3d, pix_b1_yresvsmodetaphi_rms, 3);
1299  meanRMSProjections3D(pix_b2_yresvsmodetaphi_3d, pix_b2_yresvsmodetaphi_rms, 3);
1300  meanRMSProjections3D(pix_b3_yresvsmodetaphi_3d, pix_b3_xresvsmodetaphi_rms, 3);
1301 
1302  //2-d residual map histograms - SCT barrel residual means
1303  TH2F* sct_b0_xresvsmodetaphi_mean = new TH2F("sct_b0_xresvsmodetaphi_mean",
1304  "X Residual Mean vs Module Eta-Phi-ID SCT Barrel L0", 13, -6.5, 6.5,
1305  32, -0.5, 31.5);
1306  sct_b0_xresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1307  sct_b0_xresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1308  TH2F* sct_b1_xresvsmodetaphi_mean = new TH2F("sct_b1_xresvsmodetaphi_mean",
1309  "X Residual Mean vs Module Eta-Phi-ID SCT Barrel L1", 13, -6.5, 6.5,
1310  40, -0.5, 39.5);
1311  sct_b1_xresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1312  sct_b1_xresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1313  TH2F* sct_b2_xresvsmodetaphi_mean = new TH2F("sct_b2_xresvsmodetaphi_mean",
1314  "X Residual Mean vs Module Eta-Phi-ID SCT Barrel L2", 13, -6.5, 6.5,
1315  48, -0.5, 47.5);
1316  sct_b2_xresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1317  sct_b2_xresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1318  TH2F* sct_b3_xresvsmodetaphi_mean = new TH2F("sct_b3_xresvsmodetaphi_mean",
1319  "X Residual Mean vs Module Eta-Phi-ID SCT Barrel L3", 13, -6.5, 6.5,
1320  56, -0.5, 55.5);
1321  sct_b3_xresvsmodetaphi_mean->GetXaxis()->SetTitle("Module Eta-ID");
1322  sct_b3_xresvsmodetaphi_mean->GetYaxis()->SetTitle("Module Phi-ID");
1323  meanRMSProjections3D(sct_b0_xresvsmodetaphi_3d, sct_b0_xresvsmodetaphi_mean, 2);
1324  meanRMSProjections3D(sct_b1_xresvsmodetaphi_3d, sct_b1_xresvsmodetaphi_mean, 2);
1325  meanRMSProjections3D(sct_b2_xresvsmodetaphi_3d, sct_b2_xresvsmodetaphi_mean, 2);
1326  meanRMSProjections3D(sct_b3_xresvsmodetaphi_3d, sct_b3_xresvsmodetaphi_mean, 2);
1327 
1328  //2-d residual map histograms - SCT barrel residual widths
1329  TH2F* sct_b0_xresvsmodetaphi_rms = new TH2F("sct_b0_xresvsmodetaphi_rms",
1330  "X Residual Width vs Module Eta-Phi-ID SCT Barrel L0", 13, -6.5, 6.5,
1331  32, -0.5, 31.5);
1332  sct_b0_xresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1333  sct_b0_xresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1334  TH2F* sct_b1_xresvsmodetaphi_rms = new TH2F("sct_b1_xresvsmodetaphi_rms",
1335  "X Residual Width vs Module Eta-Phi-ID SCT Barrel L1", 13, -6.5, 6.5,
1336  40, -0.5, 39.5);
1337  sct_b1_xresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1338  sct_b1_xresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1339  TH2F* sct_b2_xresvsmodetaphi_rms = new TH2F("sct_b2_xresvsmodetaphi_rms",
1340  "X Residual Width vs Module Eta-Phi-ID SCT Barrel L2", 13, -6.5, 6.5,
1341  48, -0.5, 47.5);
1342  sct_b2_xresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1343  sct_b2_xresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1344  TH2F* sct_b3_xresvsmodetaphi_rms = new TH2F("sct_b3_xresvsmodetaphi_rms",
1345  "X Residual Width vs Module Eta-Phi-ID SCT Barrel L3", 13, -6.5, 6.5,
1346  56, -0.5, 55.5);
1347  sct_b3_xresvsmodetaphi_rms->GetXaxis()->SetTitle("Module Eta-ID");
1348  sct_b3_xresvsmodetaphi_rms->GetYaxis()->SetTitle("Module Phi-ID");
1349  meanRMSProjections3D(sct_b0_xresvsmodetaphi_3d, sct_b0_xresvsmodetaphi_rms, 3);
1350  meanRMSProjections3D(sct_b1_xresvsmodetaphi_3d, sct_b1_xresvsmodetaphi_rms, 3);
1351  meanRMSProjections3D(sct_b2_xresvsmodetaphi_3d, sct_b2_xresvsmodetaphi_rms, 3);
1352  meanRMSProjections3D(sct_b3_xresvsmodetaphi_3d, sct_b3_xresvsmodetaphi_rms, 3);
1353 
1354  //histograms showing the distribution of Gaussian fitted residual means for pixel and SCT barrel (should add
1355  // endcaps)
1356  //modules are required to have > 30 hits
1357  TH1F* pix_b0_residualmeans = new TH1F("pix_b0_residualmeans", "Pixel Barrel Layer 0 Mean of Residual Distributions",
1358  100, -0.2, 0.2);
1359  pix_b0_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1360  pix_b0_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1361  TH1F* pix_b1_residualmeans = new TH1F("pix_b1_residualmeans", "Pixel Barrel Layer 1 Mean of Residual Distributions",
1362  100, -0.2, 0.2);
1363  pix_b1_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1364  pix_b1_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1365  TH1F* pix_b2_residualmeans = new TH1F("pix_b2_residualmeans", "Pixel Barrel Layer 2 Mean of Residual Distributions",
1366  100, -0.2, 0.2);
1367  pix_b2_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1368  pix_b2_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1369  TH1F* pix_b3_residualmeans = new TH1F("pix_b3_residualmeans", "Pixel Barrel Layer 3 Mean of Residual Distributions",
1370  100, -0.2, 0.2);
1371  pix_b3_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1372  pix_b3_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1373  meanRMSProjections3D_DMRPlot(pix_b0_xresvsmodetaphi_3d, pix_b0_residualmeans, 2);
1374  meanRMSProjections3D_DMRPlot(pix_b1_xresvsmodetaphi_3d, pix_b1_residualmeans, 2);
1375  meanRMSProjections3D_DMRPlot(pix_b2_xresvsmodetaphi_3d, pix_b2_residualmeans, 2);
1376  meanRMSProjections3D_DMRPlot(pix_b3_xresvsmodetaphi_3d, pix_b3_residualmeans, 2);
1377 
1378 
1379  TH1F* pix_b_residualmeans = new TH1F("pix_b_residualmeans", "Pixel Barrel Mean of Residual Distributions", 100,
1380  -0.2, 0.2);
1381  pix_b_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1382  pix_b_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1383  pix_b_residualmeans->Add(pix_b0_residualmeans);
1384  pix_b_residualmeans->Add(pix_b1_residualmeans);
1385  pix_b_residualmeans->Add(pix_b2_residualmeans);
1386  pix_b_residualmeans->Add(pix_b3_residualmeans);
1387 
1388  TH1F* sct_b0_residualmeans = new TH1F("sct_b0_residualmeans", "SCT Barrel Layer 0 Mean of Residual Distributions",
1389  100, -0.2, 0.2);
1390  sct_b0_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1391  sct_b0_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1392  TH1F* sct_b1_residualmeans = new TH1F("sct_b1_residualmeans", "SCT Barrel Layer 1 Mean of Residual Distributions",
1393  100, -0.2, 0.2);
1394  sct_b1_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1395  sct_b1_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1396  TH1F* sct_b2_residualmeans = new TH1F("sct_b2_residualmeans", "SCT Barrel Layer 2 Mean of Residual Distributions",
1397  100, -0.2, 0.2);
1398  sct_b2_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1399  sct_b2_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1400  TH1F* sct_b3_residualmeans = new TH1F("sct_b3_residualmeans", "SCT Barrel Layer 3 Mean of Residual Distributions",
1401  100, -0.2, 0.2);
1402  sct_b3_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1403  sct_b3_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1404  meanRMSProjections3D_DMRPlot(sct_b0_xresvsmodetaphi_3d, sct_b0_residualmeans, 2);
1405  meanRMSProjections3D_DMRPlot(sct_b1_xresvsmodetaphi_3d, sct_b1_residualmeans, 2);
1406  meanRMSProjections3D_DMRPlot(sct_b2_xresvsmodetaphi_3d, sct_b2_residualmeans, 2);
1407  meanRMSProjections3D_DMRPlot(sct_b3_xresvsmodetaphi_3d, sct_b3_residualmeans, 2);
1408 
1409  TH1F* sct_b_residualmeans = new TH1F("sct_b_residualmeans", "SCT Barrel Mean of Residual Distributions", 100, -0.2,
1410  0.2);
1411  sct_b_residualmeans->GetXaxis()->SetTitle("Fitted Residual Mean [mm]");
1412  sct_b_residualmeans->GetYaxis()->SetTitle("Number of Modules/4#mum");
1413  sct_b_residualmeans->Add(sct_b0_residualmeans);
1414  sct_b_residualmeans->Add(sct_b1_residualmeans);
1415  sct_b_residualmeans->Add(sct_b2_residualmeans);
1416  sct_b_residualmeans->Add(sct_b3_residualmeans);
1417 
1418 
1419  //histograms showing the distribution of the errors on the Gaussian-fitted residual means for Pixel and SCT
1420  //i.e. the error on the residual mean entries for the plots above - this should not be larger than the bin size!
1421  //modules are required to have > 30 hits
1422  TH1F* pix_b0_residualfiterrors = new TH1F("pix_b0_residualfiterrors",
1423  "Pixel Barrel Layer 0 Residual Gaussian Fit Error", 200, 0.0, 0.02);
1424  pix_b0_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1425  pix_b0_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1426  TH1F* pix_b1_residualfiterrors = new TH1F("pix_b1_residualfiterrors",
1427  "Pixel Barrel Layer 1 Residual Gaussian Fit Error", 200, 0.0, 0.02);
1428  pix_b1_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1429  pix_b1_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1430  TH1F* pix_b2_residualfiterrors = new TH1F("pix_b2_residualfiterrors",
1431  "Pixel Barrel Layer 2 Residual Gaussian Fit Error", 200, 0.0, 0.02);
1432  pix_b2_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1433  pix_b2_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1434  TH1F* pix_b3_residualfiterrors = new TH1F("pix_b3_residualfiterrors",
1435  "Pixel Barrel Layer 3 Residual Gaussian Fit Error", 200, 0.0, 0.02);
1436  pix_b3_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1437  pix_b3_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1438  meanRMSProjections3D_DMRPlot(pix_b0_xresvsmodetaphi_3d, pix_b0_residualfiterrors, 5);
1439  meanRMSProjections3D_DMRPlot(pix_b1_xresvsmodetaphi_3d, pix_b1_residualfiterrors, 5);
1440  meanRMSProjections3D_DMRPlot(pix_b2_xresvsmodetaphi_3d, pix_b2_residualfiterrors, 5);
1441  meanRMSProjections3D_DMRPlot(pix_b3_xresvsmodetaphi_3d, pix_b3_residualfiterrors, 5);
1442 
1443  TH1F* pix_b_residualfiterrors = new TH1F("pix_b_residualfiterrors", "Pixel Barrel Residual Gaussian Fit Error", 200,
1444  -0.0, 0.02);
1445  pix_b_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1446  pix_b_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1447  pix_b_residualfiterrors->Add(pix_b0_residualfiterrors);
1448  pix_b_residualfiterrors->Add(pix_b1_residualfiterrors);
1449  pix_b_residualfiterrors->Add(pix_b2_residualfiterrors);
1450  pix_b_residualfiterrors->Add(pix_b3_residualfiterrors);
1451 
1452 
1453 
1454  TH1F* sct_b0_residualfiterrors = new TH1F("sct_b0_residualfiterrors",
1455  "SCT Barrel Layer 0 Residual Gaussian Fit Error", 200, 0.0, 0.02);
1456  sct_b0_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1457  sct_b0_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1458  TH1F* sct_b1_residualfiterrors = new TH1F("sct_b1_residualfiterrors",
1459  "SCT Barrel Layer 1 Residual Gaussian Fit Error", 200, 0.0, 0.02);
1460  sct_b1_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1461  sct_b1_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1462  TH1F* sct_b2_residualfiterrors = new TH1F("sct_b2_residualfiterrors",
1463  "SCT Barrel Layer 2 Residual Gaussian Fit Error", 200, 0.0, 0.02);
1464  sct_b2_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1465  sct_b2_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1466  TH1F* sct_b3_residualfiterrors = new TH1F("sct_b3_residualfiterrors",
1467  "SCT Barrel Layer 3 Residual Gaussian Fit Error", 200, 0.0, 0.02);
1468  sct_b3_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1469  sct_b3_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1470  meanRMSProjections3D_DMRPlot(sct_b0_xresvsmodetaphi_3d, sct_b0_residualfiterrors, 5);
1471  meanRMSProjections3D_DMRPlot(sct_b1_xresvsmodetaphi_3d, sct_b1_residualfiterrors, 5);
1472  meanRMSProjections3D_DMRPlot(sct_b2_xresvsmodetaphi_3d, sct_b2_residualfiterrors, 5);
1473  meanRMSProjections3D_DMRPlot(sct_b3_xresvsmodetaphi_3d, sct_b3_residualfiterrors, 5);
1474 
1475  TH1F* sct_b_residualfiterrors = new TH1F("sct_b_residualfiterrors", "SCT Barrel Residual Gaussian Fit Error", 200,
1476  -0.0, 0.02);
1477  sct_b_residualfiterrors->GetXaxis()->SetTitle("Residual Gaus. Fit Error [mm]");
1478  sct_b_residualfiterrors->GetYaxis()->SetTitle("Number of Modules");
1479  sct_b_residualfiterrors->Add(sct_b0_residualfiterrors);
1480  sct_b_residualfiterrors->Add(sct_b1_residualfiterrors);
1481  sct_b_residualfiterrors->Add(sct_b2_residualfiterrors);
1482  sct_b_residualfiterrors->Add(sct_b3_residualfiterrors);
1483 
1484 
1485  // median suffers from 10micron bin size in residual distributions - means that it can only take discreet values at
1486  // 5 micron intervals
1487  TH1F* pix_b0_residualmedians = new TH1F("pix_b0_residualmedians",
1488  "Pixel Barrel Layer 0 Median of Residual Distributions", 20, -0.1, 0.1);
1489  pix_b0_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1490  pix_b0_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1491  TH1F* pix_b1_residualmedians = new TH1F("pix_b1_residualmedians",
1492  "Pixel Barrel Layer 1 Median of Residual Distributions", 20, -0.1, 0.1);
1493  pix_b1_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1494  pix_b1_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1495  TH1F* pix_b2_residualmedians = new TH1F("pix_b2_residualmedians",
1496  "Pixel Barrel Layer 2 Median of Residual Distributions", 20, -0.1, 0.1);
1497  pix_b2_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1498  pix_b2_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1499  TH1F* pix_b3_residualmedians = new TH1F("pix_b3_residualmedians",
1500  "Pixel Barrel Layer 3 Median of Residual Distributions", 20, -0.1, 0.1);
1501  pix_b3_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1502  pix_b3_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1503  meanRMSProjections3D_DMRPlot(pix_b0_xresvsmodetaphi_3d, pix_b0_residualmedians, 6);
1504  meanRMSProjections3D_DMRPlot(pix_b1_xresvsmodetaphi_3d, pix_b1_residualmedians, 6);
1505  meanRMSProjections3D_DMRPlot(pix_b2_xresvsmodetaphi_3d, pix_b2_residualmedians, 6);
1506  meanRMSProjections3D_DMRPlot(pix_b3_xresvsmodetaphi_3d, pix_b3_residualmedians, 6);
1507 
1508  TH1F* pix_b_residualmedians = new TH1F("pix_b_residualmedians", "Pixel Barrel Median of Residual Distributions", 20,
1509  -0.1, 0.1);
1510  pix_b_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1511  pix_b_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1512  pix_b_residualmedians->Add(pix_b0_residualmedians);
1513  pix_b_residualmedians->Add(pix_b1_residualmedians);
1514  pix_b_residualmedians->Add(pix_b2_residualmedians);
1515  pix_b_residualmedians->Add(pix_b3_residualmedians);
1516 
1517 
1518 
1519  TH1F* sct_b0_residualmedians = new TH1F("sct_b0_residualmedians",
1520  "SCT Barrel Layer 0 Median of Residual Distributions", 20, -0.1, 0.1);
1521  sct_b0_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1522  sct_b0_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1523  TH1F* sct_b1_residualmedians = new TH1F("sct_b1_residualmedians",
1524  "SCT Barrel Layer 1 Median of Residual Distributions", 20, -0.1, 0.1);
1525  sct_b1_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1526  sct_b1_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1527  TH1F* sct_b2_residualmedians = new TH1F("sct_b2_residualmedians",
1528  "SCT Barrel Layer 2 Median of Residual Distributions", 20, -0.1, 0.1);
1529  sct_b2_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1530  sct_b2_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1531  TH1F* sct_b3_residualmedians = new TH1F("sct_b3_residualmedians",
1532  "SCT Barrel Layer 3 Median of Residual Distributions", 20, -0.1, 0.1);
1533  sct_b3_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1534  sct_b3_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1535  meanRMSProjections3D_DMRPlot(sct_b0_xresvsmodetaphi_3d, sct_b0_residualmedians, 6);
1536  meanRMSProjections3D_DMRPlot(sct_b1_xresvsmodetaphi_3d, sct_b1_residualmedians, 6);
1537  meanRMSProjections3D_DMRPlot(sct_b2_xresvsmodetaphi_3d, sct_b2_residualmedians, 6);
1538  meanRMSProjections3D_DMRPlot(sct_b3_xresvsmodetaphi_3d, sct_b3_residualmedians, 6);
1539 
1540  TH1F* sct_b_residualmedians = new TH1F("sct_b_residualmedians", "SCT Barrel Median of Residual Distributions", 20,
1541  -0.1, 0.1);
1542  sct_b_residualmedians->GetXaxis()->SetTitle("Residual Median [mm]");
1543  sct_b_residualmedians->GetYaxis()->SetTitle("Number of Modules/10#mum");
1544  sct_b_residualmedians->Add(sct_b0_residualmedians);
1545  sct_b_residualmedians->Add(sct_b1_residualmedians);
1546  sct_b_residualmedians->Add(sct_b2_residualmedians);
1547  sct_b_residualmedians->Add(sct_b3_residualmedians);
1548 
1549 
1550  //TH2F* pix_b0_xresvsmodetaphi_chi2 = new TH2F("pix_b0_xresvsmodetaphi_chi2","X Residual Fit Chi2/DOF vs Module
1551  // Eta-Phi-ID Pixel Barrel L0",13,-6.5,6.5,22,-0.5,21.5);
1552  //pix_b0_xresvsmodetaphi_chi2->GetXaxis()->SetTitle("Module Eta-ID");
1553  //pix_b0_xresvsmodetaphi_chi2->GetYaxis()->SetTitle("Module Phi-ID");
1554  //meanRMSProjections3D(pix_b0_xresvsmodetaphi_3d,pix_b0_xresvsmodetaphi_chi2,4);
1555 
1556 
1557  //set y-axis minimum range
1558  setMinWindow(si_barrel_pullX_width, minSiPullWidthWindow, maxSiPullWidthWindow);
1559  setMinWindow(si_barrel_pullY_width, minSiPullWidthWindow, maxSiPullWidthWindow);
1560  setMinWindow(si_eca_pullX_width, minSiPullWidthWindow, maxSiPullWidthWindow);
1561  setMinWindow(si_eca_pullY_width, minSiPullWidthWindow, maxSiPullWidthWindow);
1562  setMinWindow(si_ecc_pullX_width, minSiPullWidthWindow, maxSiPullWidthWindow);
1563  setMinWindow(si_ecc_pullY_width, minSiPullWidthWindow, maxSiPullWidthWindow);
1564 
1565  setMinWindow(si_barrel_pullX_mean, minSiResMeanWindow, maxSiResMeanWindow);
1566  setMinWindow(si_barrel_pullY_mean, minSiResMeanWindow, maxSiResMeanWindow);
1567  setMinWindow(si_eca_pullX_mean, minSiResMeanWindow, maxSiResMeanWindow);
1568  setMinWindow(si_eca_pullY_mean, minSiResMeanWindow, maxSiResMeanWindow);
1569  setMinWindow(si_ecc_pullX_mean, minSiResMeanWindow, maxSiResMeanWindow);
1570  setMinWindow(si_ecc_pullY_mean, minSiResMeanWindow, maxSiResMeanWindow);
1571 
1572  setMinWindow(si_barrel_resX_mean, minSiResMeanWindow, maxSiResMeanWindow);
1573  setMinWindow(si_barrel_resY_mean, minSiResMeanWindow, maxSiResMeanWindow);
1574  setMinWindow(si_eca_resX_mean, minSiResMeanWindow, maxSiResMeanWindow);
1575  setMinWindow(si_eca_resY_mean, minSiResMeanWindow, maxSiResMeanWindow);
1576  setMinWindow(si_ecc_resX_mean, minSiResMeanWindow, maxSiResMeanWindow);
1577  setMinWindow(si_ecc_resY_mean, minSiResMeanWindow, maxSiResMeanWindow);
1578 
1579  setMinWindow(si_barrel_resX_rms, minSiResWidthWindow, maxSiResWidthWindow);
1580  setMinWindow(si_barrel_resY_rms, minSiResWidthWindow, maxSiResWidthWindow);
1581  setMinWindow(si_eca_resX_rms, minSiResWidthWindow, maxSiResWidthWindow);
1582  setMinWindow(si_eca_resY_rms, minSiResWidthWindow, maxSiResWidthWindow);
1583  setMinWindow(si_ecc_resX_rms, minSiResWidthWindow, maxSiResWidthWindow);
1584  setMinWindow(si_ecc_resY_rms, minSiResWidthWindow, maxSiResWidthWindow);
1585 
1586  setMinWindow(pix_b_xresvsmodeta, minSiResMeanWindow, maxSiResMeanWindow);
1587  setMinWindow(pix_b_yresvsmodeta, minSiResMeanWindow, maxSiResMeanWindow);
1588  setMinWindow(pix_b_xresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1589  setMinWindow(pix_b_yresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1590  setMinWindow(sct_b_xresvsmodeta, minSiResMeanWindow, maxSiResMeanWindow);
1591  setMinWindow(sct_b_xresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1592 
1593  setMinWindow(pix_b_xresvsmodeta_width, minSiResWidthWindow, maxSiResWidthWindow);
1594  setMinWindow(pix_b_yresvsmodeta_width, minSiResWidthWindow, maxSiResWidthWindow);
1595  setMinWindow(pix_b_xresvsmodphi_width, minSiResWidthWindow, maxSiResWidthWindow);
1596  setMinWindow(pix_b_yresvsmodphi_width, minSiResWidthWindow, maxSiResWidthWindow);
1597  setMinWindow(sct_b_xresvsmodeta_width, minSiResWidthWindow, maxSiResWidthWindow);
1598  setMinWindow(sct_b_xresvsmodphi_width, minSiResWidthWindow, maxSiResWidthWindow);
1599 
1600  setMinWindow(pix_eca_xresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1601  setMinWindow(pix_eca_yresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1602  setMinWindow(pix_ecc_xresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1603  setMinWindow(pix_ecc_yresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1604  setMinWindow(sct_eca_xresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1605  setMinWindow(sct_ecc_xresvsmodphi, minSiResMeanWindow, maxSiResMeanWindow);
1606 
1607 
1608  if (f->cd(path.c_str()) == 0) {
1609  //std::cerr << "MonitoringFile::fitMergedFile_IDAlignMonResiduals(): "
1610  // << "No such directory \"" << path << "\"\n";
1611  return;
1612  }
1613 
1614  //delete the histograms already in the file with these keys so that
1615  //they can be overwritten - we shouldn't have to do this, but seems to
1616  //be necessary
1617  f->Delete("si_barrel_pullX_width;1");
1618 
1619  f->Delete("si_eca_pullX_width;1");
1620  f->Delete("si_ecc_pullX_width;1");
1621  f->Delete("si_barrel_pullY_width;1");
1622  f->Delete("si_eca_pullY_width;1");
1623  f->Delete("si_ecc_pullY_width;1");
1624 
1625  f->Delete("si_barrel_pullX_mean;1");
1626  f->Delete("si_eca_pullX_mean;1");
1627  f->Delete("si_ecc_pullX_mean;1");
1628  f->Delete("si_barrel_pullY_mean;1");
1629  f->Delete("si_eca_pullY_mean;1");
1630  f->Delete("si_ecc_pullY_mean;1");
1631 
1632  f->Delete("si_barrel_resX_mean;1");
1633  f->Delete("si_eca_resX_mean;1");
1634  f->Delete("si_ecc_resX_mean;1");
1635  f->Delete("si_barrel_resY_mean;1");
1636  f->Delete("si_eca_resY_mean;1");
1637  f->Delete("si_ecc_resY_mean;1");
1638 
1639  f->Delete("si_barrel_resX_rms;1");
1640  f->Delete("si_eca_resX_rms;1");
1641  f->Delete("si_ecc_resX_rms;1");
1642  f->Delete("si_barrel_resY_rms;1");
1643  f->Delete("si_eca_resY_rms;1");
1644  f->Delete("si_ecc_resY_rms;1");
1645 
1646  f->Delete("pix_b_xresvsmodeta;1");
1647  f->Delete("pix_b_xresvsmodphi;1");
1648  f->Delete("pix_b_yresvsmodeta;1");
1649  f->Delete("pix_b_yresvsmodphi;1");
1650  f->Delete("pix_eca_xresvsmodphi;1");
1651  f->Delete("pix_ecc_xresvsmodphi;1");
1652  f->Delete("pix_eca_yresvsmodphi;1");
1653  f->Delete("pix_ecc_yresvsmodphi;1");
1654 
1655  f->Delete("pix_b_xresvsmodeta_width;1");
1656  f->Delete("pix_b_yresvsmodeta_width;1");
1657  f->Delete("pix_b_xresvsmodphi_width;1");
1658  f->Delete("pix_b_yresvsmodphi_width;1");
1659  f->Delete("sct_b_xresvsmodeta_width;1");
1660  f->Delete("sct_b_xresvsmodphi_width;1");
1661 
1662  f->Delete("sct_b_xresvsmodeta;1");
1663  f->Delete("sct_b_xresvsmodphi;1");
1664  f->Delete("sct_eca_xresvsmodphi;1");
1665  f->Delete("sct_ecc_xresvsmodphi;1");
1666 
1667  f->Delete("pix_b0_xresvsmodetaphi_mean;1");
1668  f->Delete("pix_b1_xresvsmodetaphi_mean;1");
1669  f->Delete("pix_b2_xresvsmodetaphi_mean;1");
1670  f->Delete("pix_b3_xresvsmodetaphi_mean;1");
1671  f->Delete("pix_b0_yresvsmodetaphi_mean;1");
1672  f->Delete("pix_b1_yresvsmodetaphi_mean;1");
1673  f->Delete("pix_b2_yresvsmodetaphi_mean;1");
1674  f->Delete("pix_b3_yresvsmodetaphi_mean;1");
1675 
1676  f->Delete("pix_b0_xresvsmodetaphi_rms;1");
1677  f->Delete("pix_b1_xresvsmodetaphi_rms;1");
1678  f->Delete("pix_b2_xresvsmodetaphi_rms;1");
1679  f->Delete("pix_b3_xresvsmodetaphi_rms;1");
1680  f->Delete("pix_b0_yresvsmodetaphi_rms;1");
1681  f->Delete("pix_b1_yresvsmodetaphi_rms;1");
1682  f->Delete("pix_b2_yresvsmodetaphi_rms;1");
1683  f->Delete("pix_b3_yresvsmodetaphi_rms;1");
1684 
1685  f->Delete("sct_b0_xresvsmodetaphi_mean;1");
1686  f->Delete("sct_b1_xresvsmodetaphi_mean;1");
1687  f->Delete("sct_b2_xresvsmodetaphi_mean;1");
1688  f->Delete("sct_b3_xresvsmodetaphi_mean;1");
1689 
1690  f->Delete("sct_b0_xresvsmodetaphi_rms;1");
1691  f->Delete("sct_b1_xresvsmodetaphi_rms;1");
1692  f->Delete("sct_b2_xresvsmodetaphi_rms;1");
1693  f->Delete("sct_b3_xresvsmodetaphi_rms;1");
1694 
1695  //writing the histograms to the file
1696  si_barrel_pullX_width->Write("", TObject::kOverwrite);
1697  si_eca_pullX_width->Write("", TObject::kOverwrite);
1698  si_ecc_pullX_width->Write("", TObject::kOverwrite);
1699  si_barrel_pullY_width->Write("", TObject::kOverwrite);
1700  si_eca_pullY_width->Write("", TObject::kOverwrite);
1701  si_ecc_pullY_width->Write("", TObject::kOverwrite);
1702 
1703  si_barrel_pullX_mean->Write("", TObject::kOverwrite);
1704  si_eca_pullX_mean->Write("", TObject::kOverwrite);
1705  si_ecc_pullX_mean->Write("", TObject::kOverwrite);
1706  si_barrel_pullY_mean->Write("", TObject::kOverwrite);
1707  si_eca_pullY_mean->Write("", TObject::kOverwrite);
1708  si_ecc_pullY_mean->Write("", TObject::kOverwrite);
1709 
1710  f->Write();
1711 
1712  si_barrel_resX_mean->Write("", TObject::kOverwrite);
1713  si_eca_resX_mean->Write("", TObject::kOverwrite);
1714  si_ecc_resX_mean->Write("", TObject::kOverwrite);
1715  si_barrel_resY_mean->Write("", TObject::kOverwrite);
1716  si_eca_resY_mean->Write("", TObject::kOverwrite);
1717  si_ecc_resY_mean->Write("", TObject::kOverwrite);
1718 
1719  si_barrel_resX_rms->Write("", TObject::kOverwrite);
1720  si_eca_resX_rms->Write("", TObject::kOverwrite);
1721  si_ecc_resX_rms->Write("", TObject::kOverwrite);
1722  si_barrel_resY_rms->Write("", TObject::kOverwrite);
1723  si_eca_resY_rms->Write("", TObject::kOverwrite);
1724  si_ecc_resY_rms->Write("", TObject::kOverwrite);
1725 
1726  // Q: why do we need to call f->Write() more than once?
1727  // A: Because root is a pile of horse s**t.
1728  f->Write();
1729 
1730  pix_b_xresvsmodeta->Write("", TObject::kOverwrite);
1731  pix_b_xresvsmodphi->Write("", TObject::kOverwrite);
1732  pix_b_yresvsmodeta->Write("", TObject::kOverwrite);
1733  pix_b_yresvsmodphi->Write("", TObject::kOverwrite);
1734  pix_eca_xresvsmodphi->Write("", TObject::kOverwrite);
1735  pix_ecc_xresvsmodphi->Write("", TObject::kOverwrite);
1736  pix_eca_yresvsmodphi->Write("", TObject::kOverwrite);
1737  pix_ecc_yresvsmodphi->Write("", TObject::kOverwrite);
1738 
1739  f->Write();
1740 
1741  sct_b_xresvsmodeta->Write("", TObject::kOverwrite);
1742  sct_b_xresvsmodphi->Write("", TObject::kOverwrite);
1743  sct_eca_xresvsmodphi->Write("", TObject::kOverwrite);
1744  sct_ecc_xresvsmodphi->Write("", TObject::kOverwrite);
1745 
1746  pix_b_xresvsmodeta_width->Write("", TObject::kOverwrite);
1747  pix_b_yresvsmodeta_width->Write("", TObject::kOverwrite);
1748  pix_b_xresvsmodphi_width->Write("", TObject::kOverwrite);
1749  pix_b_yresvsmodphi_width->Write("", TObject::kOverwrite);
1750  sct_b_xresvsmodeta_width->Write("", TObject::kOverwrite);
1751  sct_b_xresvsmodphi_width->Write("", TObject::kOverwrite);
1752 
1753  f->Write();
1754 
1755  pix_b0_xresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1756  pix_b1_xresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1757  pix_b2_xresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1758  pix_b3_xresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1759  pix_b0_yresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1760  pix_b1_yresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1761  pix_b2_yresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1762  pix_b3_yresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1763 
1764  f->Write();
1765 
1766  pix_b0_xresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1767  pix_b1_xresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1768  pix_b2_xresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1769  pix_b3_xresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1770  pix_b0_yresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1771  pix_b1_yresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1772  pix_b2_yresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1773  pix_b3_yresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1774 
1775  //m_pix_b0_xresvsmodetaphi_chi2->Write("",TObject::kOverwrite);
1776 
1777  f->Write();
1778 
1779  sct_b0_xresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1780  sct_b1_xresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1781  sct_b2_xresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1782  sct_b3_xresvsmodetaphi_mean->Write("", TObject::kOverwrite);
1783 
1784  sct_b0_xresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1785  sct_b1_xresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1786  sct_b2_xresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1787  sct_b3_xresvsmodetaphi_rms->Write("", TObject::kOverwrite);
1788 
1789  f->Write();
1790 
1791  pix_b0_residualmeans->Write("", TObject::kOverwrite);
1792  pix_b1_residualmeans->Write("", TObject::kOverwrite);
1793  pix_b2_residualmeans->Write("", TObject::kOverwrite);
1794  pix_b3_residualmeans->Write("", TObject::kOverwrite);
1795  sct_b0_residualmeans->Write("", TObject::kOverwrite);
1796  sct_b1_residualmeans->Write("", TObject::kOverwrite);
1797  sct_b2_residualmeans->Write("", TObject::kOverwrite);
1798  sct_b3_residualmeans->Write("", TObject::kOverwrite);
1799  pix_b_residualmeans->Write("", TObject::kOverwrite);
1800  sct_b_residualmeans->Write("", TObject::kOverwrite);
1801  pix_b_residualmedians->Write("", TObject::kOverwrite);
1802  sct_b_residualmedians->Write("", TObject::kOverwrite);
1803 
1804  f->Write();
1805 
1806  pix_b0_residualfiterrors->Write("", TObject::kOverwrite);
1807  pix_b1_residualfiterrors->Write("", TObject::kOverwrite);
1808  pix_b2_residualfiterrors->Write("", TObject::kOverwrite);
1809  pix_b3_residualfiterrors->Write("", TObject::kOverwrite);
1810  sct_b0_residualfiterrors->Write("", TObject::kOverwrite);
1811  sct_b1_residualfiterrors->Write("", TObject::kOverwrite);
1812  sct_b2_residualfiterrors->Write("", TObject::kOverwrite);
1813  sct_b3_residualfiterrors->Write("", TObject::kOverwrite);
1814  pix_b_residualfiterrors->Write("", TObject::kOverwrite);
1815  sct_b_residualfiterrors->Write("", TObject::kOverwrite);
1816 
1817  f->Write();
1818 
1819  //pix_b0_mag_vs_lb->Write();
1820  //pix_b0_base_vs_lb->Write();
1821 
1822  //f->Write();
1823 
1824 
1825 
1826 
1827 
1828  if (doOverlapResiduals) {
1829  TH3F* pix_b0_Oxresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b0_Oxresxvsmodetaphi_3d").c_str()));
1830  TH3F* pix_b1_Oxresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b1_Oxresxvsmodetaphi_3d").c_str()));
1831  TH3F* pix_b2_Oxresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b2_Oxresxvsmodetaphi_3d").c_str()));
1832  TH3F* pix_b3_Oxresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b3_Oxresxvsmodetaphi_3d").c_str()));
1833 
1834  TH3F* pix_b0_Oxresyvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b0_Oxresyvsmodetaphi_3d").c_str()));
1835  TH3F* pix_b1_Oxresyvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b1_Oxresyvsmodetaphi_3d").c_str()));
1836  TH3F* pix_b2_Oxresyvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b2_Oxresyvsmodetaphi_3d").c_str()));
1837  TH3F* pix_b3_Oxresyvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b3_Oxresyvsmodetaphi_3d").c_str()));
1838 
1839  TH3F* pix_b0_Oyresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b0_Oyresxvsmodetaphi_3d").c_str()));
1840  TH3F* pix_b1_Oyresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b1_Oyresxvsmodetaphi_3d").c_str()));
1841  TH3F* pix_b2_Oyresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b2_Oyresxvsmodetaphi_3d").c_str()));
1842  TH3F* pix_b3_Oyresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b3_Oyresxvsmodetaphi_3d").c_str()));
1843 
1844  TH3F* pix_b0_Oyresyvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b0_Oyresyvsmodetaphi_3d").c_str()));
1845  TH3F* pix_b1_Oyresyvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b1_Oyresyvsmodetaphi_3d").c_str()));
1846  TH3F* pix_b2_Oyresyvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b2_Oyresyvsmodetaphi_3d").c_str()));
1847  TH3F* pix_b3_Oyresyvsmodetaphi_3d = (TH3F*) (f->Get((path + "/pix_b3_Oyresyvsmodetaphi_3d").c_str()));
1848 
1849  TH3F* sct_b0_Oxresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b0_Oxresxvsmodetaphi_3d").c_str()));
1850  TH3F* sct_b1_Oxresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b1_Oxresxvsmodetaphi_3d").c_str()));
1851  TH3F* sct_b2_Oxresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b2_Oxresxvsmodetaphi_3d").c_str()));
1852  TH3F* sct_b3_Oxresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b3_Oxresxvsmodetaphi_3d").c_str()));
1853 
1854  TH3F* sct_b0_Oyresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b0_Oyresxvsmodetaphi_3d").c_str()));
1855  TH3F* sct_b1_Oyresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b1_Oyresxvsmodetaphi_3d").c_str()));
1856  TH3F* sct_b2_Oyresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b2_Oyresxvsmodetaphi_3d").c_str()));
1857  TH3F* sct_b3_Oyresxvsmodetaphi_3d = (TH3F*) (f->Get((path + "/sct_b3_Oyresxvsmodetaphi_3d").c_str()));
1858 
1859 
1860  //XOverlap residual X mean as a function of ring in the pixel barrel (sensitive to ring-expansion,contraction
1861  // distortions)
1862  TH1F* pix_b0_Oxresxvsmodeta_mean = new TH1F("pix_b0_Oxresxvsmodeta_mean",
1863  "X-Overlap X Residual Mean vs Eta-ID Pixel Barrel IBL", 20, -10.5,
1864  9.5);
1865  TH1F* pix_b1_Oxresxvsmodeta_mean = new TH1F("pix_b1_Oxresxvsmodeta_mean",
1866  "X-Overlap X Residual Mean vs Eta-ID Pixel Barrel L0", 13, -6.5, 6.5);
1867  TH1F* pix_b2_Oxresxvsmodeta_mean = new TH1F("pix_b2_Oxresxvsmodeta_mean",
1868  "X-Overlap X Residual Mean vs Eta-ID Pixel Barrel L1", 13, -6.5, 6.5);
1869  TH1F* pix_b3_Oxresxvsmodeta_mean = new TH1F("pix_b3_Oxresxvsmodeta_mean",
1870  "X-Overlap X Residual Mean vs Eta-ID Pixel Barrel L2", 13, -6.5, 6.5);
1871  pix_b0_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
1872  pix_b1_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
1873  pix_b2_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
1874  pix_b3_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
1875  pix_b0_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
1876  pix_b1_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
1877  pix_b2_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
1878  pix_b3_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
1879  meanRMSProjections3D_XY(pix_b0_Oxresxvsmodetaphi_3d, pix_b0_Oxresxvsmodeta_mean, 0, 2);
1880  meanRMSProjections3D_XY(pix_b1_Oxresxvsmodetaphi_3d, pix_b1_Oxresxvsmodeta_mean, 0, 2);
1881  meanRMSProjections3D_XY(pix_b2_Oxresxvsmodetaphi_3d, pix_b2_Oxresxvsmodeta_mean, 0, 2);
1882  meanRMSProjections3D_XY(pix_b3_Oxresxvsmodetaphi_3d, pix_b3_Oxresxvsmodeta_mean, 0, 2);
1883  plots->Add(pix_b0_Oxresxvsmodeta_mean);
1884  plots->Add(pix_b1_Oxresxvsmodeta_mean);
1885  plots->Add(pix_b2_Oxresxvsmodeta_mean);
1886  plots->Add(pix_b3_Oxresxvsmodeta_mean);
1887  TH1F* pix_b_Oxresxvsmodeta_mean = combineHistos("pix_b_Oxresxvsmodeta_mean",
1888  "X-Overlap X Residual Mean vs (Modified) Eta-ID Pixel Barrel",
1889  plots, 10);
1890  pix_b_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
1891  pix_b_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("(Modified) Module Eta-ID");
1892  plots->Clear();
1893 
1894  //XOverlap residual X width as a function of ring in the pixel barrel (sensitive to ring-expansion,contraction
1895  // distortions)
1896  TH1F* pix_b0_Oxresxvsmodeta_width = new TH1F("pix_b0_Oxresxvsmodeta_width",
1897  "X-Overlap X Residual Width vs Eta-ID Pixel Barrel IBL", 20, -10.5,
1898  9.5);
1899  TH1F* pix_b1_Oxresxvsmodeta_width = new TH1F("pix_b1_Oxresxvsmodeta_width",
1900  "X-Overlap X Residual Width vs Eta-ID Pixel Barrel L0", 13, -6.5,
1901  6.5);
1902  TH1F* pix_b2_Oxresxvsmodeta_width = new TH1F("pix_b2_Oxresxvsmodeta_width",
1903  "X-Overlap X Residual Width vs Eta-ID Pixel Barrel L1", 13, -6.5,
1904  6.5);
1905  TH1F* pix_b3_Oxresxvsmodeta_width = new TH1F("pix_b3_Oxresxvsmodeta_width",
1906  "X-Overlap X Residual Width vs Eta-ID Pixel Barrel L2", 13, -6.5,
1907  6.5);
1908  pix_b0_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
1909  pix_b1_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
1910  pix_b2_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
1911  pix_b2_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
1912  pix_b0_Oxresxvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1913  pix_b1_Oxresxvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1914  pix_b2_Oxresxvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1915  pix_b2_Oxresxvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1916  meanRMSProjections3D_XY(pix_b0_Oxresxvsmodetaphi_3d, pix_b0_Oxresxvsmodeta_width, 0, 3);
1917  meanRMSProjections3D_XY(pix_b1_Oxresxvsmodetaphi_3d, pix_b1_Oxresxvsmodeta_width, 0, 3);
1918  meanRMSProjections3D_XY(pix_b2_Oxresxvsmodetaphi_3d, pix_b2_Oxresxvsmodeta_width, 0, 3);
1919  meanRMSProjections3D_XY(pix_b3_Oxresxvsmodetaphi_3d, pix_b3_Oxresxvsmodeta_width, 0, 3);
1920  plots->Add(pix_b0_Oxresxvsmodeta_width);
1921  plots->Add(pix_b1_Oxresxvsmodeta_width);
1922  plots->Add(pix_b2_Oxresxvsmodeta_width);
1923  plots->Add(pix_b3_Oxresxvsmodeta_width);
1924  TH1F* pix_b_Oxresxvsmodeta_width = combineHistos("pix_b_Oxresxvsmodeta_width",
1925  "X-Overlap X Residual Width vs (Modified) Eta-ID Pixel Barrel",
1926  plots, 10);
1927  pix_b_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
1928  pix_b_Oxresxvsmodeta_width->GetXaxis()->SetTitle("(Modified) Module Eta-ID");
1929  plots->Clear();
1930 
1931  //XOverlap residual Y mean as a function of ring in the pixel barrel (sensitive to ring shear distortions)
1932  TH1F* pix_b0_Oxresyvsmodeta_mean = new TH1F("pix_b0_Oxresyvsmodeta_mean",
1933  "X-Overlap Y Residual Mean vs Eta-ID Pixel Barrel IBL", 20, -10.5,
1934  9.5);
1935  TH1F* pix_b1_Oxresyvsmodeta_mean = new TH1F("pix_b1_Oxresyvsmodeta_mean",
1936  "X-Overlap Y Residual Mean vs Eta-ID Pixel Barrel L0", 13, -6.5, 6.5);
1937  TH1F* pix_b2_Oxresyvsmodeta_mean = new TH1F("pix_b2_Oxresyvsmodeta_mean",
1938  "X-Overlap Y Residual Mean vs Eta-ID Pixel Barrel L1", 13, -6.5, 6.5);
1939  TH1F* pix_b3_Oxresyvsmodeta_mean = new TH1F("pix_b3_Oxresyvsmodeta_mean",
1940  "X-Overlap Y Residual Mean vs Eta-ID Pixel Barrel L2", 13, -6.5, 6.5);
1941  pix_b0_Oxresyvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual Y");
1942  pix_b1_Oxresyvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual Y");
1943  pix_b2_Oxresyvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual Y");
1944  pix_b3_Oxresyvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual Y");
1945  pix_b0_Oxresyvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
1946  pix_b1_Oxresyvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
1947  pix_b2_Oxresyvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
1948  pix_b3_Oxresyvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
1949  meanRMSProjections3D_XY(pix_b0_Oxresyvsmodetaphi_3d, pix_b0_Oxresyvsmodeta_mean, 0, 2);
1950  meanRMSProjections3D_XY(pix_b1_Oxresyvsmodetaphi_3d, pix_b1_Oxresyvsmodeta_mean, 0, 2);
1951  meanRMSProjections3D_XY(pix_b2_Oxresyvsmodetaphi_3d, pix_b2_Oxresyvsmodeta_mean, 0, 2);
1952  meanRMSProjections3D_XY(pix_b3_Oxresyvsmodetaphi_3d, pix_b3_Oxresyvsmodeta_mean, 0, 2);
1953  plots->Add(pix_b0_Oxresyvsmodeta_mean);
1954  plots->Add(pix_b1_Oxresyvsmodeta_mean);
1955  plots->Add(pix_b2_Oxresyvsmodeta_mean);
1956  plots->Add(pix_b3_Oxresyvsmodeta_mean);
1957 
1958  TH1F* pix_b_Oxresyvsmodeta_mean = combineHistos("pix_b_Oxresyvsmodeta_mean",
1959  "X-Overlap Y Residual Mean vs (Modified) Eta-ID Pixel Barrel",
1960  plots, 10);
1961  pix_b_Oxresyvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual Y");
1962  pix_b_Oxresyvsmodeta_mean->GetXaxis()->SetTitle("(Modified) Module Eta-ID");
1963  plots->Clear();
1964 
1965  //XOverlap residual X width as a function of ring in the pixel barrel (sensitive to ring shear distortions)
1966  TH1F* pix_b0_Oxresyvsmodeta_width = new TH1F("pix_b0_Oxresyvsmodeta_width",
1967  "X-Overlap Y Residual Width vs Eta-ID Pixel Barrel IBL", 20, -10.5,
1968  9.5);
1969  TH1F* pix_b1_Oxresyvsmodeta_width = new TH1F("pix_b1_Oxresyvsmodeta_width",
1970  "X-Overlap Y Residual Width vs Eta-ID Pixel Barrel L0", 13, -6.5,
1971  6.5);
1972  TH1F* pix_b2_Oxresyvsmodeta_width = new TH1F("pix_b2_Oxresyvsmodeta_width",
1973  "X-Overlap Y Residual Width vs Eta-ID Pixel Barrel L1", 13, -6.5,
1974  6.5);
1975  TH1F* pix_b3_Oxresyvsmodeta_width = new TH1F("pix_b3_Oxresyvsmodeta_width",
1976  "X-Overlap Y Residual Width vs Eta-ID Pixel Barrel L2", 13, -6.5,
1977  6.5);
1978  pix_b0_Oxresyvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual Y");
1979  pix_b1_Oxresyvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual Y");
1980  pix_b2_Oxresyvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual Y");
1981  pix_b3_Oxresyvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual Y");
1982  pix_b0_Oxresyvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1983  pix_b1_Oxresyvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1984  pix_b2_Oxresyvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1985  pix_b3_Oxresyvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
1986  meanRMSProjections3D_XY(pix_b0_Oxresyvsmodetaphi_3d, pix_b0_Oxresyvsmodeta_width, 0, 3);
1987  meanRMSProjections3D_XY(pix_b1_Oxresyvsmodetaphi_3d, pix_b1_Oxresyvsmodeta_width, 0, 3);
1988  meanRMSProjections3D_XY(pix_b2_Oxresyvsmodetaphi_3d, pix_b2_Oxresyvsmodeta_width, 0, 3);
1989  meanRMSProjections3D_XY(pix_b3_Oxresyvsmodetaphi_3d, pix_b3_Oxresyvsmodeta_width, 0, 3);
1990  plots->Add(pix_b0_Oxresyvsmodeta_width);
1991  plots->Add(pix_b1_Oxresyvsmodeta_width);
1992  plots->Add(pix_b2_Oxresyvsmodeta_width);
1993  plots->Add(pix_b3_Oxresyvsmodeta_width);
1994  TH1F* pix_b_Oxresyvsmodeta_width = combineHistos("pix_b_Oxresyvsmodeta_width",
1995  "X-Overlap Y Residual Width vs (Modified) Eta-ID Pixel Barrel",
1996  plots, 10);
1997  pix_b_Oxresyvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual Y");
1998  pix_b_Oxresyvsmodeta_width->GetXaxis()->SetTitle("(Modified) Module Eta-ID");
1999  plots->Clear();
2000 
2001  //YOverlap residual Y mean as a function of stave in the pixel barrel (sensitive to stave-stretch distortions)
2002  TH1F* pix_b0_Oyresyvsmodphi_mean = new TH1F("pix_b0_Oyresyvsmodphi_mean",
2003  "Y-Overlap Y Residual Mean vs Phi-ID Pixel Barrel IBL", 14, -0.5,
2004  13.5);
2005  TH1F* pix_b1_Oyresyvsmodphi_mean = new TH1F("pix_b1_Oyresyvsmodphi_mean",
2006  "Y-Overlap Y Residual Mean vs Phi-ID Pixel Barrel L0", 22, -0.5,
2007  21.5);
2008  TH1F* pix_b2_Oyresyvsmodphi_mean = new TH1F("pix_b2_Oyresyvsmodphi_mean",
2009  "Y-Overlap Y Residual Mean vs Phi-ID Pixel Barrel L1", 38, -0.5,
2010  37.5);
2011  TH1F* pix_b3_Oyresyvsmodphi_mean = new TH1F("pix_b3_Oyresyvsmodphi_mean",
2012  "Y-Overlap Y Residual Mean vs Phi-ID Pixel Barrel L2", 52, -0.5,
2013  51.5);
2014  pix_b0_Oyresyvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual Y");
2015  pix_b1_Oyresyvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual Y");
2016  pix_b2_Oyresyvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual Y");
2017  pix_b3_Oyresyvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual Y");
2018  pix_b0_Oyresyvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2019  pix_b1_Oyresyvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2020  pix_b2_Oyresyvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2021  pix_b3_Oyresyvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2022  meanRMSProjections3D_XY(pix_b0_Oyresyvsmodetaphi_3d, pix_b0_Oyresyvsmodphi_mean, 1, 2);
2023  meanRMSProjections3D_XY(pix_b1_Oyresyvsmodetaphi_3d, pix_b1_Oyresyvsmodphi_mean, 1, 2);
2024  meanRMSProjections3D_XY(pix_b2_Oyresyvsmodetaphi_3d, pix_b2_Oyresyvsmodphi_mean, 1, 2);
2025  meanRMSProjections3D_XY(pix_b3_Oyresyvsmodetaphi_3d, pix_b3_Oyresyvsmodphi_mean, 1, 2);
2026  plots->Add(pix_b0_Oyresyvsmodphi_mean);
2027  plots->Add(pix_b1_Oyresyvsmodphi_mean);
2028  plots->Add(pix_b2_Oyresyvsmodphi_mean);
2029  plots->Add(pix_b3_Oyresyvsmodphi_mean);
2030  TH1F* pix_b_Oyresyvsmodphi_mean = combineHistos("pix_b_Oyresyvsmodphi_mean",
2031  "Y-Overlap Y Residual Mean vs (Modified) Eta-ID Pixel Barrel",
2032  plots, 10);
2033  pix_b_Oyresyvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual Y");
2034  pix_b_Oyresyvsmodphi_mean->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
2035  plots->Clear();
2036 
2037  //YOverlap residual Y width as a function of stave in the pixel barrel (sensitive to stave-stretch distortions)
2038  TH1F* pix_b0_Oyresyvsmodphi_width = new TH1F("pix_b0_Oyresyvsmodphi_width",
2039  "Y-Overlap Y Residual Width vs Phi-ID Pixel Barrel IBL", 14, -0.5,
2040  13.5);
2041  TH1F* pix_b1_Oyresyvsmodphi_width = new TH1F("pix_b1_Oyresyvsmodphi_width",
2042  "Y-Overlap Y Residual Width vs Phi-ID Pixel Barrel L0", 22, -0.5,
2043  21.5);
2044  TH1F* pix_b2_Oyresyvsmodphi_width = new TH1F("pix_b2_Oyresyvsmodphi_width",
2045  "Y-Overlap Y Residual Width vs Phi-ID Pixel Barrel L1", 38, -0.5,
2046  37.5);
2047  TH1F* pix_b3_Oyresyvsmodphi_width = new TH1F("pix_b3_Oyresyvsmodphi_width",
2048  "Y-Overlap Y Residual Width vs Phi-ID Pixel Barrel L2", 52, -0.5,
2049  51.5);
2050  pix_b0_Oyresyvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual Y");
2051  pix_b1_Oyresyvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual Y");
2052  pix_b2_Oyresyvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual Y");
2053  pix_b3_Oyresyvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual Y");
2054  pix_b0_Oyresyvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2055  pix_b1_Oyresyvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2056  pix_b2_Oyresyvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2057  pix_b3_Oyresyvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2058  meanRMSProjections3D_XY(pix_b0_Oyresyvsmodetaphi_3d, pix_b0_Oyresyvsmodphi_width, 1, 3);
2059  meanRMSProjections3D_XY(pix_b1_Oyresyvsmodetaphi_3d, pix_b1_Oyresyvsmodphi_width, 1, 3);
2060  meanRMSProjections3D_XY(pix_b2_Oyresyvsmodetaphi_3d, pix_b2_Oyresyvsmodphi_width, 1, 3);
2061  meanRMSProjections3D_XY(pix_b3_Oyresyvsmodetaphi_3d, pix_b3_Oyresyvsmodphi_width, 1, 3);
2062  plots->Add(pix_b0_Oyresyvsmodphi_width);
2063  plots->Add(pix_b1_Oyresyvsmodphi_width);
2064  plots->Add(pix_b2_Oyresyvsmodphi_width);
2065  plots->Add(pix_b3_Oyresyvsmodphi_width);
2066  TH1F* pix_b_Oyresyvsmodphi_width = combineHistos("pix_b_Oyresyvsmodphi_width",
2067  "Y-Overlap Y Residual Width vs (Modified) Eta-ID Pixel Barrel",
2068  plots, 10);
2069  pix_b_Oyresyvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual Y");
2070  pix_b_Oyresyvsmodphi_width->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
2071  plots->Clear();
2072 
2073  //YOverlap residual X mean as a function of stave in the pixel barrel (sensitive to stave-shear distortions)
2074  TH1F* pix_b0_Oyresxvsmodphi_mean = new TH1F("pix_b0_Oyresxvsmodphi_mean",
2075  "Y-Overlap X Residual Mean vs Phi-ID Pixel Barrel IBL", 14, -0.5,
2076  13.5);
2077  TH1F* pix_b1_Oyresxvsmodphi_mean = new TH1F("pix_b1_Oyresxvsmodphi_mean",
2078  "Y-Overlap X Residual Mean vs Phi-ID Pixel Barrel L0", 22, -0.5,
2079  21.5);
2080  TH1F* pix_b2_Oyresxvsmodphi_mean = new TH1F("pix_b2_Oyresxvsmodphi_mean",
2081  "Y-Overlap X Residual Mean vs Phi-ID Pixel Barrel L1", 38, -0.5,
2082  37.5);
2083  TH1F* pix_b3_Oyresxvsmodphi_mean = new TH1F("pix_b3_Oyresxvsmodphi_mean",
2084  "Y-Overlap X Residual Mean vs Phi-ID Pixel Barrel L2", 52, -0.5,
2085  51.5);
2086  pix_b0_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2087  pix_b1_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2088  pix_b2_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2089  pix_b3_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2090  pix_b0_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2091  pix_b1_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2092  pix_b2_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2093  pix_b3_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2094  meanRMSProjections3D_XY(pix_b0_Oyresxvsmodetaphi_3d, pix_b0_Oyresxvsmodphi_mean, 1, 2);
2095  meanRMSProjections3D_XY(pix_b1_Oyresxvsmodetaphi_3d, pix_b1_Oyresxvsmodphi_mean, 1, 2);
2096  meanRMSProjections3D_XY(pix_b2_Oyresxvsmodetaphi_3d, pix_b2_Oyresxvsmodphi_mean, 1, 2);
2097  meanRMSProjections3D_XY(pix_b3_Oyresxvsmodetaphi_3d, pix_b3_Oyresxvsmodphi_mean, 1, 2);
2098  plots->Add(pix_b0_Oyresxvsmodphi_mean);
2099  plots->Add(pix_b1_Oyresxvsmodphi_mean);
2100  plots->Add(pix_b2_Oyresxvsmodphi_mean);
2101  plots->Add(pix_b3_Oyresxvsmodphi_mean);
2102  TH1F* pix_b_Oyresxvsmodphi_mean = combineHistos("pix_b_Oyresxvsmodphi_mean",
2103  "Y-Overlap X Residual Mean vs (Modified) Eta-ID Pixel Barrel",
2104  plots, 10);
2105  pix_b_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2106  pix_b_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
2107  plots->Clear();
2108 
2109  //YOverlap residual X width as a function of stave in the pixel barrel (sensitive to stave-shear distortions)
2110 
2111  TH1F* pix_b0_Oyresxvsmodphi_width = new TH1F("pix_b0_Oyresxvsmodphi_width",
2112  "Y-Overlap X Residual Width vs Phi-ID Pixel Barrel IBL", 14, -0.5,
2113  13.5);
2114  TH1F* pix_b1_Oyresxvsmodphi_width = new TH1F("pix_b1_Oyresxvsmodphi_width",
2115  "Y-Overlap X Residual Width vs Phi-ID Pixel Barrel L0", 22, -0.5,
2116  21.5);
2117  TH1F* pix_b2_Oyresxvsmodphi_width = new TH1F("pix_b2_Oyresxvsmodphi_width",
2118  "Y-Overlap X Residual Width vs Phi-ID Pixel Barrel L1", 38, -0.5,
2119  37.5);
2120  TH1F* pix_b3_Oyresxvsmodphi_width = new TH1F("pix_b3_Oyresxvsmodphi_width",
2121  "Y-Overlap X Residual Width vs Phi-ID Pixel Barrel L2", 52, -0.5,
2122  51.5);
2123  pix_b0_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2124  pix_b1_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2125  pix_b2_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2126  pix_b3_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2127  pix_b0_Oyresxvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2128  pix_b1_Oyresxvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2129  pix_b2_Oyresxvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2130  pix_b3_Oyresxvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2131  meanRMSProjections3D_XY(pix_b0_Oyresxvsmodetaphi_3d, pix_b0_Oyresxvsmodphi_width, 1, 3);
2132  meanRMSProjections3D_XY(pix_b1_Oyresxvsmodetaphi_3d, pix_b1_Oyresxvsmodphi_width, 1, 3);
2133  meanRMSProjections3D_XY(pix_b2_Oyresxvsmodetaphi_3d, pix_b2_Oyresxvsmodphi_width, 1, 3);
2134  meanRMSProjections3D_XY(pix_b3_Oyresxvsmodetaphi_3d, pix_b3_Oyresxvsmodphi_width, 1, 3);
2135  plots->Add(pix_b0_Oyresxvsmodphi_width);
2136  plots->Add(pix_b1_Oyresxvsmodphi_width);
2137  plots->Add(pix_b2_Oyresxvsmodphi_width);
2138  plots->Add(pix_b3_Oyresxvsmodphi_width);
2139  TH1F* pix_b_Oyresxvsmodphi_width = combineHistos("pix_b_Oyresxvsmodphi_width",
2140  "Y-Overlap X Residual Width vs (Modified) Eta-ID Pixel Barrel",
2141  plots, 10);
2142  pix_b_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2143  pix_b_Oyresxvsmodphi_width->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
2144  plots->Clear();
2145 
2146  //XOverlap residual X mean as a function of ring in the SCT barrel (sensitive to ring-expansion,contraction
2147  // distortions)
2148  TH1F* sct_b0_Oxresxvsmodeta_mean = new TH1F("sct_b0_Oxresxvsmodeta_mean",
2149  "X-Overlap X Residual Mean vs Eta-ID SCT Barrel L0", 13, -6.5, 6.5);
2150  TH1F* sct_b1_Oxresxvsmodeta_mean = new TH1F("sct_b1_Oxresxvsmodeta_mean",
2151  "X-Overlap X Residual Mean vs Eta-ID SCT Barrel L1", 13, -6.5, 6.5);
2152  TH1F* sct_b2_Oxresxvsmodeta_mean = new TH1F("sct_b2_Oxresxvsmodeta_mean",
2153  "X-Overlap X Residual Mean vs Eta-ID SCT Barrel L2", 13, -6.5, 6.5);
2154  TH1F* sct_b3_Oxresxvsmodeta_mean = new TH1F("sct_b3_Oxresxvsmodeta_mean",
2155  "X-Overlap X Residual Mean vs Eta-ID SCT Barrel L3", 13, -6.5, 6.5);
2156  sct_b0_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
2157  sct_b1_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
2158  sct_b2_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
2159  sct_b3_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
2160  sct_b0_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
2161  sct_b1_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
2162  sct_b2_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
2163  sct_b3_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("Module Eta-ID");
2164  meanRMSProjections3D_XY(sct_b0_Oxresxvsmodetaphi_3d, sct_b0_Oxresxvsmodeta_mean, 0, 2);
2165  meanRMSProjections3D_XY(sct_b1_Oxresxvsmodetaphi_3d, sct_b1_Oxresxvsmodeta_mean, 0, 2);
2166  meanRMSProjections3D_XY(sct_b2_Oxresxvsmodetaphi_3d, sct_b2_Oxresxvsmodeta_mean, 0, 2);
2167  meanRMSProjections3D_XY(sct_b3_Oxresxvsmodetaphi_3d, sct_b3_Oxresxvsmodeta_mean, 0, 2);
2168  plots->Add(sct_b0_Oxresxvsmodeta_mean);
2169  plots->Add(sct_b1_Oxresxvsmodeta_mean);
2170  plots->Add(sct_b2_Oxresxvsmodeta_mean);
2171  plots->Add(sct_b3_Oxresxvsmodeta_mean);
2172  TH1F* sct_b_Oxresxvsmodeta_mean = combineHistos("sct_b_Oxresxvsmodeta_mean",
2173  "X-Overlap X Residual Mean vs (Modified) Eta-ID SCT Barrel",
2174  plots, 10);
2175  sct_b_Oxresxvsmodeta_mean->GetYaxis()->SetTitle("X-Overlap Mean Residual X");
2176  sct_b_Oxresxvsmodeta_mean->GetXaxis()->SetTitle("(Modified) Module Eta-ID");
2177  plots->Clear();
2178 
2179 
2180  //XOverlap residual X width as a function of ring in the SCT barrel (sensitive to ring-expansion,contraction
2181  // distortions)
2182  TH1F* sct_b0_Oxresxvsmodeta_width = new TH1F("sct_b0_Oxresxvsmodeta_width",
2183  "X-Overlap X Residual Width vs Eta-ID SCT Barrel L0", 13, -6.5, 6.5);
2184  TH1F* sct_b1_Oxresxvsmodeta_width = new TH1F("sct_b1_Oxresxvsmodeta_width",
2185  "X-Overlap X Residual Width vs Eta-ID SCT Barrel L1", 13, -6.5, 6.5);
2186  TH1F* sct_b2_Oxresxvsmodeta_width = new TH1F("sct_b2_Oxresxvsmodeta_width",
2187  "X-Overlap X Residual Width vs Eta-ID SCT Barrel L2", 13, -6.5, 6.5);
2188  TH1F* sct_b3_Oxresxvsmodeta_width = new TH1F("sct_b3_Oxresxvsmodeta_width",
2189  "X-Overlap X Residual Width vs Eta-ID SCT Barrel L3", 13, -6.5, 6.5);
2190  sct_b0_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
2191  sct_b1_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
2192  sct_b2_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
2193  sct_b3_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
2194  sct_b0_Oxresxvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
2195  sct_b1_Oxresxvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
2196  sct_b2_Oxresxvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
2197  sct_b3_Oxresxvsmodeta_width->GetXaxis()->SetTitle("Module Eta-ID");
2198  meanRMSProjections3D_XY(sct_b0_Oxresxvsmodetaphi_3d, sct_b0_Oxresxvsmodeta_width, 0, 3);
2199  meanRMSProjections3D_XY(sct_b1_Oxresxvsmodetaphi_3d, sct_b1_Oxresxvsmodeta_width, 0, 3);
2200  meanRMSProjections3D_XY(sct_b2_Oxresxvsmodetaphi_3d, sct_b2_Oxresxvsmodeta_width, 0, 3);
2201  meanRMSProjections3D_XY(sct_b3_Oxresxvsmodetaphi_3d, sct_b3_Oxresxvsmodeta_width, 0, 3);
2202  plots->Add(sct_b0_Oxresxvsmodeta_width);
2203  plots->Add(sct_b1_Oxresxvsmodeta_width);
2204  plots->Add(sct_b2_Oxresxvsmodeta_width);
2205  plots->Add(sct_b3_Oxresxvsmodeta_width);
2206  TH1F* sct_b_Oxresxvsmodeta_width = combineHistos("sct_b_Oxresxvsmodeta_width",
2207  "X-Overlap X Residual Width vs (Modified) Eta-ID SCT Barrel",
2208  plots, 10);
2209  sct_b_Oxresxvsmodeta_width->GetYaxis()->SetTitle("X-Overlap Width Residual X");
2210  sct_b_Oxresxvsmodeta_width->GetXaxis()->SetTitle("(Modified) Module Eta-ID");
2211  plots->Clear();
2212 
2213 
2214  //YOverlap residual X mean as a function of stave in the SCT barrel (sensitive to stave shear distortions)
2215  TH1F* sct_b0_Oyresxvsmodphi_mean = new TH1F("sct_b0_Oyresxvsmodphi_mean",
2216  "Y-Overlap X Residual Mean vs Phi-ID SCT Barrel L0", 32, -0.5, 31.5);
2217  TH1F* sct_b1_Oyresxvsmodphi_mean = new TH1F("sct_b1_Oyresxvsmodphi_mean",
2218  "Y-Overlap X Residual Mean vs Phi-ID SCT Barrel L1", 40, -0.5, 39.5);
2219  TH1F* sct_b2_Oyresxvsmodphi_mean = new TH1F("sct_b2_Oyresxvsmodphi_mean",
2220  "Y-Overlap X Residual Mean vs Phi-ID SCT Barrel L2", 48, -0.5, 47.5);
2221  TH1F* sct_b3_Oyresxvsmodphi_mean = new TH1F("sct_b3_Oyresxvsmodphi_mean",
2222  "Y-Overlap X Residual Mean vs Phi-ID SCT Barrel L3", 56, -0.5, 55.5);
2223  sct_b0_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2224  sct_b1_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2225  sct_b2_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2226  sct_b3_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2227  sct_b0_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2228  sct_b1_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2229  sct_b2_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2230  sct_b3_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("Module Phi-ID");
2231  meanRMSProjections3D_XY(sct_b0_Oyresxvsmodetaphi_3d, sct_b0_Oyresxvsmodphi_mean, 1, 2);
2232  meanRMSProjections3D_XY(sct_b1_Oyresxvsmodetaphi_3d, sct_b1_Oyresxvsmodphi_mean, 1, 2);
2233  meanRMSProjections3D_XY(sct_b2_Oyresxvsmodetaphi_3d, sct_b2_Oyresxvsmodphi_mean, 1, 2);
2234  meanRMSProjections3D_XY(sct_b3_Oyresxvsmodetaphi_3d, sct_b3_Oyresxvsmodphi_mean, 1, 2);
2235  plots->Add(sct_b0_Oyresxvsmodphi_mean);
2236  plots->Add(sct_b1_Oyresxvsmodphi_mean);
2237  plots->Add(sct_b2_Oyresxvsmodphi_mean);
2238  plots->Add(sct_b3_Oyresxvsmodphi_mean);
2239  TH1F* sct_b_Oyresxvsmodphi_mean = combineHistos("sct_b_Oyresxvsmodphi_mean",
2240  "Y-Overlap X Residual Mean vs (Modified) Phi-ID SCT Barrel",
2241  plots, 10);
2242  sct_b_Oyresxvsmodphi_mean->GetYaxis()->SetTitle("Y-Overlap Mean Residual X");
2243  sct_b_Oyresxvsmodphi_mean->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
2244  plots->Clear();
2245 
2246  //YOverlap residual X width as a function of stave in the SCT barrel (sensitive to stave shear distortions)
2247  TH1F* sct_b0_Oyresxvsmodphi_width = new TH1F("sct_b0_Oyresxvsmodphi_width",
2248  "Y-Overlap X Residual Width vs Phi-ID SCT Barrel L0", 32, -0.5,
2249  31.5);
2250  TH1F* sct_b1_Oyresxvsmodphi_width = new TH1F("sct_b1_Oyresxvsmodphi_width",
2251  "Y-Overlap X Residual Width vs Phi-ID SCT Barrel L1", 40, -0.5,
2252  39.5);
2253  TH1F* sct_b2_Oyresxvsmodphi_width = new TH1F("sct_b2_Oyresxvsmodphi_width",
2254  "Y-Overlap X Residual Width vs Phi-ID SCT Barrel L2", 48, -0.5,
2255  47.5);
2256  TH1F* sct_b3_Oyresxvsmodphi_width = new TH1F("sct_b3_Oyresxvsmodphi_width",
2257  "Y-Overlap X Residual Width vs Phi-ID SCT Barrel L3", 56, -0.5,
2258  55.5);
2259  sct_b0_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2260  sct_b1_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2261  sct_b2_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2262  sct_b3_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2263  sct_b0_Oyresxvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2264  sct_b1_Oyresxvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2265  sct_b2_Oyresxvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2266  sct_b3_Oyresxvsmodphi_width->GetXaxis()->SetTitle("Module Phi-ID");
2267  meanRMSProjections3D_XY(sct_b0_Oyresxvsmodetaphi_3d, sct_b0_Oyresxvsmodphi_width, 1, 3);
2268  meanRMSProjections3D_XY(sct_b1_Oyresxvsmodetaphi_3d, sct_b1_Oyresxvsmodphi_width, 1, 3);
2269  meanRMSProjections3D_XY(sct_b2_Oyresxvsmodetaphi_3d, sct_b2_Oyresxvsmodphi_width, 1, 3);
2270  meanRMSProjections3D_XY(sct_b3_Oyresxvsmodetaphi_3d, sct_b3_Oyresxvsmodphi_width, 1, 3);
2271  plots->Add(sct_b0_Oyresxvsmodphi_width);
2272  plots->Add(sct_b1_Oyresxvsmodphi_width);
2273  plots->Add(sct_b2_Oyresxvsmodphi_width);
2274  plots->Add(sct_b3_Oyresxvsmodphi_width);
2275  TH1F* sct_b_Oyresxvsmodphi_width = combineHistos("sct_b_Oyresxvsmodphi_width",
2276  "Y-Overlap X Residual Width vs (Modified) Phi-ID SCT Barrel",
2277  plots, 10);
2278  sct_b_Oyresxvsmodphi_width->GetYaxis()->SetTitle("Y-Overlap Width Residual X");
2279  sct_b_Oyresxvsmodphi_width->GetXaxis()->SetTitle("(Modified) Module Phi-ID");
2280  plots->Clear();
2281 
2282 
2283  //write the overlap histograms to file
2284  pix_b_Oxresxvsmodeta_mean->Write("", TObject::kOverwrite);
2285  pix_b_Oxresxvsmodeta_width->Write("", TObject::kOverwrite);
2286  pix_b_Oxresyvsmodeta_mean->Write("", TObject::kOverwrite);
2287  pix_b_Oxresyvsmodeta_width->Write("", TObject::kOverwrite);
2288  pix_b_Oyresyvsmodphi_mean->Write("", TObject::kOverwrite);
2289  pix_b_Oyresyvsmodphi_width->Write("", TObject::kOverwrite);
2290 
2291  f->Write();
2292 
2293  pix_b_Oyresxvsmodphi_mean->Write("", TObject::kOverwrite);
2294  pix_b_Oyresxvsmodphi_width->Write("", TObject::kOverwrite);
2295  sct_b_Oxresxvsmodeta_mean->Write("", TObject::kOverwrite);
2296  sct_b_Oxresxvsmodeta_width->Write("", TObject::kOverwrite);
2297  sct_b_Oyresxvsmodphi_mean->Write("", TObject::kOverwrite);
2298  sct_b_Oyresxvsmodphi_width->Write("", TObject::kOverwrite);
2299 
2300  f->Write();
2301  }
2302 
2303  return;
2304  }

◆ fitMergedFile_IDAlignMonTrackSegments()

void dqutils::MonitoringFile::fitMergedFile_IDAlignMonTrackSegments ( TFile *  file,
const std::string &  run_dir,
const std::string &  tracksName 
)
static

Definition at line 178 of file MonitoringFile_IDAlignPostProcess.cxx.

179  {
180  //std::cout << "in fitMergedFile_IDAlignMonTrackSegments " << std::endl;
181 
182  std::string path;
183  path = run_dir + "IDAlignMon/" + tracksName + "/TrackSegments";
184  if (file->cd(path.c_str()) == 0) {
185  //std::cerr << "MonitoringFile::fitMergedFile_IDAlignMonTrackSegments(): "
186  // << "No such directory \"" << path << "\"\n";
187  return;
188  }
189 
190  //The Charge Mis-Indentification Histograms
191  //===========================================
192 
193  unsigned int nChargeHistograms = 4;
194 
195  //The input/source files
196  TH2F* oldChargeHists[4];
197 
198  //The output/destination files
199  TH1F* newChargeHists[4];
200  newChargeHists[0] = NULL;
201  newChargeHists[1] = NULL;
202  newChargeHists[2] = NULL;
203  newChargeHists[3] = NULL;
204 
205  //The names of the input files
206  std::string chargeHistNames[4];
207  chargeHistNames[0] = "delta_chargeVsPtLow";
208  chargeHistNames[1] = "delta_chargeVsPtUp";
209  chargeHistNames[2] = "delta_chargeVsD0";
210  chargeHistNames[3] = "delta_chargeVsZ0";
211 
212  std::string chargeHistTitle[4];
213  chargeHistTitle[0] = "Mis-Id ratio vs pT (Low)";
214  chargeHistTitle[1] = "Mis-Id ratio vs pT (Up)";
215  chargeHistTitle[2] = "Mis-Id ratio vs d_{0}";
216  chargeHistTitle[3] = "Mis-Id ratio vs Z0";
217 
218  std::string chargeHistXAxisTitles[4];
219  chargeHistXAxisTitles[0] = "p_{T} Low (GeV)";
220  chargeHistXAxisTitles[1] = "p_{T} Up (GeV)";
221  chargeHistXAxisTitles[2] = "d_{0} (mm)";
222  chargeHistXAxisTitles[3] = "z_{0} (mm)";
223 
224  //loop over the number of histograms to be created
225  for (unsigned int j = 0; j < nChargeHistograms; ++j) {
226  //We write the hist only if the input exist.
227  if (!CheckHistogram(file, (path + "/" + chargeHistNames[j]).c_str())) continue;
228 
229  //get them
230  oldChargeHists[j] = (TH2F*) (file->Get((path + "/" + chargeHistNames[j]).c_str()));
231 
232  //get binning
233  unsigned int nbinsX = oldChargeHists[j]->GetNbinsX();
234  float LE = oldChargeHists[j]->GetBinLowEdge(1);
235  float UE = oldChargeHists[j]->GetBinLowEdge(nbinsX + 1);
236 
237  //create the new files
238  newChargeHists[j] = new TH1F(("ratio_" + chargeHistNames[j]).c_str(), "", nbinsX, LE, UE);
239 
240  //Fill the new files
241  for (unsigned int xBin = 1; xBin != nbinsX + 1; xBin++) {
242  float ChargeMinus2 = oldChargeHists[j]->GetBinContent(xBin, 2);
243  float ChargePlus2 = oldChargeHists[j]->GetBinContent(xBin, 6);
244  float ChargeCorrect = oldChargeHists[j]->GetBinContent(xBin, 4);
245  float ChargeWrong = ChargeMinus2 + ChargePlus2;
246  if (ChargeCorrect > 0) {
247  newChargeHists[j]->SetBinContent(xBin, (ChargeWrong) / (ChargeCorrect + ChargeWrong));
248  newChargeHists[j]->SetBinError(xBin,
249  1.0 / ChargeCorrect *
250  pow(ChargeWrong * (1.0 + ChargeWrong / ChargeCorrect), 0.5));
251  } else {
252  if (ChargeWrong > 0) newChargeHists[j]->SetBinContent(xBin, 1);
253  else newChargeHists[j]->SetBinContent(xBin, 0);
254  newChargeHists[j]->SetBinError(xBin, 0);
255  }
256  }//Fill the new histograms
257 
258  newChargeHists[j]->SetTitle((chargeHistTitle[j]).c_str());
259  newChargeHists[j]->GetXaxis()->SetTitle((chargeHistXAxisTitles[j]).c_str());
260  }//over charged hists
261 
262 
263  //Write out the charge mis-id histograms
264  file->Write();
265  for (unsigned int j = 0; j < nChargeHistograms; ++j) {
266  //If the original hist dosn't exist, we didnt make a new one,
267  // so we dont write the new one
268  if (!CheckHistogram(file, (path + "/" + chargeHistNames[j]).c_str())) continue;
269 
270  if (newChargeHists[j]) newChargeHists[j]->Write("", TObject::kOverwrite);
271  }
272 
273 
274  //Delta Track Parameter Vs Track Parameter Profiles
275  //==================================================
276 
277  //The input histograms
278  TH2F* oldHists[30 * 3] = {};
279 
280  //The output histograms
281  TH1F* newHists[30 * 3 * 2] = {};
282 
283  //The names of the input files
284  std::string histNames[30];
285  histNames[0] = "delta_d0VsD0";
286  histNames[1] = "delta_d0VsZ0";
287  histNames[2] = "delta_d0VsPhi0";
288  histNames[3] = "delta_d0VsPt";
289  histNames[4] = "delta_d0VsEta";
290 
291  histNames[5] = "delta_eta0VsD0";
292  histNames[6] = "delta_eta0VsZ0";
293  histNames[7] = "delta_eta0VsPhi0";
294  histNames[8] = "delta_eta0VsPt";
295  histNames[9] = "delta_eta0VsEta";
296 
297  histNames[10] = "delta_phi0VsD0";
298  histNames[11] = "delta_phi0VsZ0";
299  histNames[12] = "delta_phi0VsPhi0";
300  histNames[13] = "delta_phi0VsPt";
301  histNames[14] = "delta_phi0VsEta";
302 
303  histNames[15] = "delta_qOverPtVsD0";
304  histNames[16] = "delta_qOverPtVsZ0";
305  histNames[17] = "delta_qOverPtVsPhi0";
306  histNames[18] = "delta_qOverPtVsPt";
307  histNames[19] = "delta_qOverPtVsEta";
308 
309  histNames[20] = "delta_z0VsD0";
310  histNames[21] = "delta_z0VsZ0";
311  histNames[22] = "delta_z0VsPhi0";
312  histNames[23] = "delta_z0VsPt";
313  histNames[24] = "delta_z0VsEta";
314 
315  histNames[25] = "delta_nHitsVsD0";
316  histNames[26] = "delta_nHitsVsZ0";
317  histNames[27] = "delta_nHitsVsPhi0";
318  histNames[28] = "delta_nHitsVsPt";
319  histNames[29] = "delta_nHitsVsEta";
320 
321  std::string histTitles[30];
322  std::string titlePrefix[2] = {
323  "average_", "sigma_"
324  };
325  std::string titlePostfix[3] = {
326  "", "(Positive Tracks)", "(Negative Tracks)"
327  };
328 
329  histTitles[0] = "#Delta d_{0} vs d_{0}^{Upper} ";
330  histTitles[1] = "#Delta d_{0} vs z_{0}^{Upper} ";
331  histTitles[2] = "#Delta d_{0} vs #phi_{0}^{Upper} ";
332  histTitles[3] = "#Delta d_{0} vs p_{T}^{Upper} ";
333  histTitles[4] = "#Delta d_{0} vs #eta^{Upper} ";
334 
335  histTitles[5] = "#Delta #eta vs d_{0}^{Upper} ";
336  histTitles[6] = "#Delta #eta vs z_{0}^{Upper} ";
337  histTitles[7] = "#Delta #eta vs #phi_{0}^{Upper} ";
338  histTitles[8] = "#Delta #eta vs p_{T}^{Upper} ";
339  histTitles[9] = "#Delta #eta vs #eta^{Upper} ";
340 
341  histTitles[10] = "#Delta phi vs d_{0}^{Upper} ";
342  histTitles[11] = "#Delta phi vs z_{0}^{Upper} ";
343  histTitles[12] = "#Delta phi vs phi0^{Upper} ";
344  histTitles[13] = "#Delta phi vs p_{T}^{Upper} ";
345  histTitles[14] = "#Delta phi vs #eta^{Upper} ";
346 
347  histTitles[15] = "#Delta q/p_{T} vs d_{0}^{Upper} ";
348  histTitles[16] = "#Delta q/p_{T} vs z_{0}^{Upper} ";
349  histTitles[17] = "#Delta q/p_{T} vs #phi_{0}^{Upper} ";
350  histTitles[18] = "#Delta q/p_{T} vs p_{T}^{Upper} ";
351  histTitles[19] = "#Delta q/p_{T} vs #eta^{Upper} ";
352 
353  histTitles[20] = "#Delta z_{0} vs d_{0}^{Upper} ";
354  histTitles[21] = "#Delta z_{0} vs z_{0}^{Upper} ";
355  histTitles[22] = "#Delta z_{0} vs #phi_{0}^{Upper} ";
356  histTitles[23] = "#Delta z_{0} vs p_{T}^{Upper} ";
357  histTitles[24] = "#Delta z_{0} vs #eta^{Upper} ";
358 
359  histTitles[25] = "#Delta nHits vs d_{0}^{Upper} ";
360  histTitles[26] = "#Delta nHits vs z_{0}^{Upper} ";
361  histTitles[27] = "#Delta nHits vs #phi_{0}^{Upper} ";
362  histTitles[28] = "#Delta nHits vs p_{T}^{Upper} ";
363  histTitles[29] = "#Delta nHits vs #eta^{Upper} ";
364 
365  std::string histXAxisTitles[5];
366  histXAxisTitles[0] = "d_{0}^{Upper} (mm)";
367  histXAxisTitles[1] = "z_{0}^{Upper} (mm)";
368  histXAxisTitles[2] = "#phi_{0}^{Upper} (rad)";
369  histXAxisTitles[3] = "p_{T}^{Upper} (GeV)";
370  histXAxisTitles[4] = "#eta^{Upper}";
371 
372  std::string histYAxisTitles[6];
373  histYAxisTitles[0] = "#Delta d_{0} (mm)";
374  histYAxisTitles[1] = "#Delta #eta";
375  histYAxisTitles[2] = "#Delta #phi (rad)";
376  histYAxisTitles[3] = "#Delta q/p_{T} (1.0/GeV)";
377  histYAxisTitles[4] = "#Delta z_{0} (mm)";
378  histYAxisTitles[5] = "#Delta nHits";
379 
380  //loop over combined/positive/negative
381  for (unsigned int i = 0; i < 3; ++i) {
382  //loop over the number of profiles to be created
383  for (unsigned int j = 0; j < 30; ++j) {
384  std::string histName;
385 
386  //Charged or Combo?
387  if (i == 0) histName += histNames[j];
388 
389  if (i == 1) histName += histNames[j] + "_p";
390 
391  if (i == 2) histName += histNames[j] + "_n";
392 
393  //We write the hist only if the input exist.
394  if (!CheckHistogram(file, (path + "/" + histName).c_str())) {
395  oldHists[30 * i + j] = 0;
396  continue;
397  }
398 
399  //get them
400  oldHists[30 * i + j] = (TH2F*) (file->Get((path + "/" + histName).c_str()));
401 
402  //get binning
403  unsigned int nbinsX = oldHists[30 * i + j]->GetNbinsX();
404  unsigned int nbinsY = oldHists[30 * i + j]->GetNbinsY();
405  float xLE = oldHists[30 * i + j]->GetXaxis()->GetBinLowEdge(1);
406  float xUE = oldHists[30 * i + j]->GetXaxis()->GetBinLowEdge(nbinsX + 1);
407  float yLE = oldHists[30 * i + j]->GetYaxis()->GetBinLowEdge(1);
408  float yUE = oldHists[30 * i + j]->GetYaxis()->GetBinLowEdge(nbinsY + 1);
409 
410  //std::cout << "i = " << i << std::endl;
411  //std::cout << "j = " << j << std::endl;
412  //loop over Average/Sigma
413  for (unsigned int k = 0; k < 2; ++k) {
414  //std::cout << "k = " << k << std::endl;
415 
416  //create the new files
417  newHists[2 * (30 * i + j) + k] = new TH1F((titlePrefix[k] + histName).c_str(), "", nbinsX, xLE, xUE);
418 
419  //Fill the new histograms
420  fillGaussianMeanOrWidth(oldHists[30 * i + j], newHists[2 * (30 * i + j) + k], yLE, yUE, k);
421 
422  newHists[2 * (30 * i + j) + k]->SetTitle((titlePrefix[k] + histName + titlePostfix[i]).c_str());
423  newHists[2 * (30 * i + j) + k]->GetXaxis()->SetTitle((histXAxisTitles[j % 5]).c_str());
424  if (j < 5) newHists[2 * (30 * i + j) + k]->GetYaxis()->SetTitle((histYAxisTitles[0]).c_str());
425  else if (j < 10) newHists[2 * (30 * i + j) + k]->GetYaxis()->SetTitle((histYAxisTitles[1]).c_str());
426  else if (j < 15) newHists[2 * (30 * i + j) + k]->GetYaxis()->SetTitle((histYAxisTitles[2]).c_str());
427  else if (j < 20) newHists[2 * (30 * i + j) + k]->GetYaxis()->SetTitle((histYAxisTitles[3]).c_str());
428  else if (j < 25) newHists[2 * (30 * i + j) + k]->GetYaxis()->SetTitle((histYAxisTitles[4]).c_str());
429  else if (j < 30) newHists[2 * (30 * i + j) + k]->GetYaxis()->SetTitle((histYAxisTitles[5]).c_str());
430  }//over the mean or the sigma
431  }//over the histgrams (j)
432  }//over the charge (i)
433 
434 
435  //loop over combined/positive/negative
436  for (unsigned int i = 0; i < 3; ++i) {
437  //loop over the number of profiles to be created
438  for (unsigned int j = 0; j < 30; ++j) {
439  //loop over average/mean
440  for (unsigned int k = 0; k < 2; ++k) {
441  std::string histName;
442  if (i == 0) histName = histNames[j];
443 
444  if (i == 1) histName = histNames[j] + "_p";
445 
446  if (i == 2) histName = histNames[j] + "_n";
447 
448  //If the original hist dosn't exist, we didnt make a new one,
449  // so we dont write the new one
450  // if (!CheckHistogram(file,(path+"/"+histName).c_str())){
451  // continue;
452  // }
453  if (oldHists[30 * i + j] == 0) {
454  //std::cout << histName << " not found" << std::endl;
455  continue;
456  }
457 
458  newHists[2 * (30 * i + j) + k]->Write("", TObject::kOverwrite);
459  }
460  }
461  }
462 
463  //Write out the delta trackP vs trackP profiles
464  //20100217 - moved here to avoid file corruption - PUEO
465  file->Write();
466  return;
467  }

◆ fitMergedFile_IDPerfMonJpsi()

void dqutils::MonitoringFile::fitMergedFile_IDPerfMonJpsi ( TFile *  f,
const std::string &  run_dir,
const std::string &  TriggerName 
)
static

Definition at line 750 of file MonitoringFile_IDPerfPostProcess.cxx.

751  {
752  std::string path;
753  path = run_dir + "IDPerfMon/Jpsi/" + TriggerName;
754 
755  if (f->cd(path.c_str()) == 0) {
756  //std::cerr//<< "MonitoringFile::fitMergedFile_IDPerfMonJpsi(): "
757  //<<"No such directory \""<< path << "\"\n";
758  return;
759  }
760 
761  TH1F* h_jpsi_invmass_vs_pt = new TH1F("Jpsi_invmass_vs_pt",
762  "Jpsi invmass-PDGmass vs. Jpsi Pt; p_{T}(J/#psi) [GeV/c]; Mass Shift [GeV/c^{2}]", 6, 10.,
763  20.);
764  TH1F* h_jpsi_invmass_vs_z0 = new TH1F("Jpsi_invmass_vs_z0",
765  "Jpsi invmass-PDGmass vs. muon z0; z0(#mu) [mm]; Mass Shift [GeV/c^{2}]", 6,
766  -100., 100.);
767  TH1F* h_jpsi_invmass_vs_phi = new TH1F("Jpsi_invmass_vs_phi",
768  "Jpsi invmass-PDGmass vs. Jpsi phi; #phi(J/#psi) [rad]; Mass Shift [GeV/c^{2}]", 6, -3.15,
769  3.15);
770  TH1F* h_jpsi_invmass_vs_phiplus = new TH1F("Jpsi_invmass_vs_phiplus",
771  "Jpsi invmass-PDGmass vs. Muon+ phi; #phi(#mu^{+}) [rad]; Mass Shift [GeV/c^{2}]", 6, -3.15,
772  3.15);
773  TH1F* h_jpsi_invmass_vs_phiminus = new TH1F("Jpsi_invmass_vs_phiminus",
774  "Jpsi invmass-PDGmass vs. Muon- phi; #phi(#mu^{-}) [rad]; Mass Shift [GeV/c^{2}]", 6, -3.15,
775  3.15);
776  TH1F* h_jpsi_invmass_vs_phidiff = new TH1F("Jpsi_invmass_vs_phidiff",
777  "Jpsi invmass-PDGmass vs. |phi(+)-phi(-)|; |#phi(#mu^{+})-#phi(#mu^{-})| [rad]; Mass Shift [GeV/c^{2}]", 6, 0.,
778  0.4);
779  TH1F* h_jpsi_invmass_vs_phisum = new TH1F("Jpsi_invmass_vs_phisum",
780  "Jpsi invmass-PDGmass vs. phi(+)+phi(-);#phi(#mu^{+})+#phi(#mu^{-}) [rad];Mass Shift [GeV/c^{2}]", 6, -3.15,
781  3.15);
782  TH1F* h_jpsi_invmass_vs_eta = new TH1F("Jpsi_invmass_vs_eta",
783  "Jpsi invmass-PDGmass vs. Jpsi eta; #eta(J/#psi); Mass Shift [GeV/c^{2}]", 6,
784  -2.4, 2.4);
785  TH1F* h_jpsi_invmass_vs_eta_barrel = new TH1F("Jpsi_invmass_vs_eta_barrel",
786  "Jpsi invmass-PDGmass vs. Jpsi eta (barrel); #eta(J/#psi); Mass Shift [GeV/c^{2}]", 2, -0.8,
787  0.8);
788  TH1F* h_jpsi_invmass_vs_eta_ecc = new TH1F("Jpsi_invmass_vs_eta_ecc",
789  "Jpsi invmass-PDGmass vs. Jpsi eta (endcap C); #eta(J/#psi); Mass Shift [GeV/c^{2}]", 2, -2.4,
790  -0.8);
791  TH1F* h_jpsi_invmass_vs_eta_eca = new TH1F("Jpsi_invmass_vs_eta_eca",
792  "Jpsi invmass-PDGmass vs. Jpsi eta (endcap A); #eta(J/#psi); Mass Shift [GeV/c^{2}]", 2, 0.8,
793  2.4);
794  TH1F* h_jpsi_invmass_vs_etaplus = new TH1F("Jpsi_invmass_vs_etaplus",
795  "Jpsi invmass-PDGmass vs. Muon+ eta; #eta(#mu^{+}); Mass Shift [GeV/c^{2}]", 6, -2.4,
796  2.4);
797  TH1F* h_jpsi_invmass_vs_etaminus = new TH1F("Jpsi_invmass_vs_etaminus",
798  "Jpsi invmass-PDGmass vs. Muon- eta; #eta(#mu^{-}); Mass Shift [GeV/c^{2}]", 6, -2.4,
799  2.4);
800  TH1F* h_jpsi_invmass_vs_maxeta = new TH1F("Jpsi_invmass_vs_maxeta",
801  "Jpsi invmass-PDGmass vs. max Muon |eta|; max|#eta(#mu)|; Mass Shift [GeV/c^{2}]", 6, -2.4,
802  2.4);
803  TH1F* h_jpsi_invmass_vs_etadiff = new TH1F("Jpsi_invmass_vs_etadiff",
804  "Jpsi invmass-PDGmass vs. eta(+)-eta(-); #eta(#mu^{+})-#eta(#mu^{-}); Mass Shift [GeV/c^{2}]", 6, -0.5,
805  0.5);
806  TH1F* h_jpsi_invmass_vs_sumeta = new TH1F("Jpsi_invmass_vs_sumeta",
807  "Jpsi invmass-PDGmass vs. eta(+)+eta(-); #eta(#mu^{+})+#eta(#mu^{-});Mass Shift [GeV/c^{2}]", 6, -4.8,
808  4.8);
809  TH1F* h_jpsi_invmass_vs_sumabseta = new TH1F("Jpsi_invmass_vs_sumabseta",
810  "Jpsi invmass-PDGmass vs. |eta(+)|+|eta(-)|;|#eta(#mu^{+})|+|#eta(#mu^{-})|;Mass Shift [GeV/c^{2}]", 6, 0.,
811  4.8);
812  TH1F* h_jpsi_invmass_vs_crt = new TH1F("Jpsi_invmass_vs_curvature",
813  "Jpsi invmass-PDGmass vs. crt(+)-|crt(-)|; 1/p_{T}(#mu^{+})-1/p_{T}(#mu^{-}) [GeV^{-1}]; Mass Shift [GeV/c^{2}]", 6, -0.15,
814  0.15);
815  TH1F* h_jpsi_invmass_vs_invpt = new TH1F("Jpsi_invmass_vs_invpt",
816  "Jpsi invmass-PDGmass vs. muon 1/Pt; 1/p_{T}(#mu) [(GeV/c)^{-1}]; Mass Shift [GeV/c^{2}]", 6, 0.05,
817  0.25);
818  TH1F* h_jpsi_invmass_vs_angle_eta = new TH1F("Jpsi_invmass_vs_angle_eta",
819  "Jpsi invmass-PDGmass vs. arccos(#Delta#eta/#DeltaR);arccos(#Delta#eta/#DeltaR); Mass Shift [GeV/c^{2}]", 6, 0.,
820  90.);
821 
822  TH1F* h_jpsi_width_vs_pt = new TH1F("Jpsi_width_vs_pt",
823  "Jpsi width vs. Jpsi Pt; p_{T}(J/#psi) [GeV/c]; Width [GeV/c^{2}]", 6, 10.,
824  20.);
825  TH1F* h_jpsi_width_vs_z0 = new TH1F("Jpsi_width_vs_z0", "Jpsi width vs. muon z0; z0(#mu) [mm]; Width [GeV/c^{2}]",
826  6, -100., 100.);
827  TH1F* h_jpsi_width_vs_phi = new TH1F("Jpsi_width_vs_phi",
828  "Jpsi width vs. Jpsi phi; #phi(J/#psi) [rad]; Width [GeV/c^{2}]", 6, -3.15,
829  3.15);
830  TH1F* h_jpsi_width_vs_phiplus = new TH1F("Jpsi_width_vs_phiplus",
831  "Jpsi width vs. Muon+ phi; #phi(#mu^{+}) [rad]; Width [GeV/c^{2}]", 6,
832  -3.15, 3.15);
833  TH1F* h_jpsi_width_vs_phiminus = new TH1F("Jpsi_width_vs_phiminus",
834  "Jpsi width vs. Muon- phi; #phi(#mu^{-}) [rad]; Width [GeV/c^{2}]", 6,
835  -3.15, 3.15);
836  TH1F* h_jpsi_width_vs_phidiff = new TH1F("Jpsi_width_vs_phidiff",
837  "Jpsi width vs. |phi(+)-phi(-)|; |#phi(#mu^{+})-#phi(#mu^{-})| [rad]; Width [GeV/c^{2}]", 6, 0.,
838  0.4);
839  TH1F* h_jpsi_width_vs_phisum = new TH1F("Jpsi_width_vs_phisum",
840  "Jpsi width vs. phi(+)+phi(-);#phi(#mu^{+})+#phi(#mu^{-}) [rad];Width [GeV/c^{2}]", 6, -3.15,
841  3.15);
842  TH1F* h_jpsi_width_vs_eta = new TH1F("Jpsi_width_vs_eta", "Jpsi width vs. Jpsi eta; #eta(J/#psi); Width[GeV/c^{2}]",
843  6, -2.4, 2.4);
844  TH1F* h_jpsi_width_vs_eta_barrel = new TH1F("Jpsi_width_vs_eta_barrel",
845  "Jpsi width vs. Jpsi eta (barrel); #eta(J/#psi); Width [GeV/c^{2}]", 2,
846  -0.8, 0.8);
847  TH1F* h_jpsi_width_vs_eta_ecc = new TH1F("Jpsi_width_vs_eta_ecc",
848  "Jpsi width vs. Jpsi eta (endcap C); #eta(J/#psi); Width [GeV/c^{2}]", 2,
849  -2.4, -0.8);
850  TH1F* h_jpsi_width_vs_eta_eca = new TH1F("Jpsi_width_vs_eta_eca",
851  "Jpsi width vs. Jpsi eta (endcap A); #eta(J/#psi); Width [GeV/c^{2}]", 2,
852  0.8, 2.4);
853  TH1F* h_jpsi_width_vs_etaplus = new TH1F("Jpsi_width_vs_etaplus",
854  "Jpsi width vs. Muon+ eta; #eta(#mu^{+}); Width [GeV/c^{2}]", 6, -2.4,
855  2.4);
856  TH1F* h_jpsi_width_vs_etaminus = new TH1F("Jpsi_width_vs_etaminus",
857  "Jpsi width vs. Muon- eta; #eta(#mu^{-}); Width [GeV/c^{2}]", 6, -2.4,
858  2.4);
859  TH1F* h_jpsi_width_vs_maxeta = new TH1F("Jpsi_width_vs_maxeta",
860  "Jpsi width vs. max Muon |eta|; max|#eta(#mu)|; Width[GeV/c^{2}]", 6, -2.4,
861  2.4);
862  TH1F* h_jpsi_width_vs_etadiff = new TH1F("Jpsi_width_vs_etadiff",
863  "Jpsi width vs. eta(+)-eta(-); #eta(#mu^{+})-#eta(#mu^{-}); Width [GeV/c^{2}]", 6, -0.5,
864  0.5);
865  TH1F* h_jpsi_width_vs_sumeta = new TH1F("Jpsi_width_vs_sumeta",
866  "Jpsi width vs. eta(+)+eta(-); #eta(#mu^{+})+#eta(#mu^{-});Width [GeV/c^{2}]", 6, -4.8,
867  4.8);
868  TH1F* h_jpsi_width_vs_sumabseta = new TH1F("Jpsi_width_vs_sumabseta",
869  "Jpsi width vs. |eta(+)|+|eta(-)|;|#eta(#mu^{+})|+|#eta(#mu^{-})|;Width [GeV/c^{2}]", 6, 0.,
870  4.8);
871  TH1F* h_jpsi_width_vs_crt = new TH1F("Jpsi_width_vs_curvature",
872  "Jpsi width vs. crt(+)-|crt(-)|; 1/p_{T}(#mu^{+})-1/p_{T}(#mu^{-}) [GeV^{-1}]; Width [GeV/c^{2}]", 6, -0.15,
873  0.15);
874  TH1F* h_jpsi_width_vs_invpt = new TH1F("Jpsi_width_vs_invpt",
875  "Jpsi width vs. muon 1/Pt; 1/p_{T}(#mu) [(GeV/c)^{-1}]; Width [GeV/c^{2}]",
876  6, 0.05, 0.25);
877  TH1F* h_jpsi_width_vs_angle_eta = new TH1F("Jpsi_width_vs_angle_eta",
878  "Jpsi width vs. arccos(#Delta#eta/#DeltaR);arccos(#Delta#eta/#DeltaR); Width [GeV/c^{2}]", 6, 0.,
879  90.);
880 
881  TH1F* h_eff_pt = new TH1F("eff_pt", "ID tracking efficiency vs p_{T} (tag-and-probe);p_{T} [GeV]", 9, 2., 20.);
882  TH1F* h_eff_eta = new TH1F("eff_eta", "ID tracking efficiency vs #eta (tag-and-probe);#eta", 10, -2.5, 2.5);
883  TH1F* h_eff_phi = new TH1F("eff_phi", "ID tracking efficiency vs #phi (tag-and-probe);#phi [rad]", 8, -3.15, 3.15);
884 
885  TH1F* h_chargeasym_vs_pt = new TH1F("chargeAsym_vs_pt",
886  "Charge asymmetry vs. p_{T};p_{T}(#mu) [GeV];#frac{N^{-}-N^{+}}{N^{-}+N^{+}}",
887  10, 0., 20.);
888 
889  const int nbins = 6;
890  TH1F* hpt[nbins];
891  TH1F* hz0[nbins];
892  TH1F* hphi[nbins];
893  TH1F* hphiplus[nbins];
894  TH1F* hphiminus[nbins];
895  TH1F* hphidiff[nbins];
896  TH1F* heta[nbins];
897  TH1F* heta_b[2];
898  TH1F* heta_ecc[2];
899  TH1F* heta_eca[2];
900  TH1F* hetadiff[nbins];
901  TH1F* hmaxeta[nbins];
902  TH1F* hinvpt[nbins];
903  TH1F* hcrt[nbins];
904  TH1F* hetaplus[nbins];
905  TH1F* hetaminus[nbins];
906  TH1F* hangle_eta[nbins];
907  TH1F* hsumphi[nbins];
908  TH1F* hsumeta[nbins];
909  TH1F* hsumabseta[nbins];
910 
911  if (!CheckHistogram(f, (path + "/Jpsi_invmass").c_str())) return;
912 
913  TH1F* h_mass = (TH1F*) (f->Get((path + "/Jpsi_invmass").c_str())->Clone());
914  if (CheckHistogram(f, (path + "/Nevents").c_str())) {
915  TH1F* h_Nevents = (TH1F*) f->Get((path + "/Nevents").c_str());
916  TH1F* h_rate = new TH1F("rate", "production rate", 1, 0, 1);
917  double Ntot = h_Nevents->GetEntries();
918  double yield = h_mass->Integral(h_mass->FindBin(2.95), h_mass->FindBin(3.25));
919  double rate = yield / Ntot;
920  double rate_error = sqrt(1 / yield + 1 / Ntot) * yield / Ntot;
921  h_rate->SetBinContent(1, rate);
922  h_rate->SetBinError(1, rate_error);
923  h_rate->Write("", TObject::kOverwrite);
924  }
925 // TH1F* h_mass_scaled = (TH1F*)(f->Get((path+"/Jpsi_invmass").c_str())->Clone("Jpsi_invmass_scaled_copy"));
926 // h_mass_scaled->SetMarkerStyle(21);
927 // TString title(h_mass_scaled->GetTitle());
928 // if (CheckHistogram(f,(path+"/Jpsi_invmass_scaled").c_str())) {
929 // if (CheckHistogram(f,(path+"/Nevents").c_str())) {
930 // TH1F* h_Nevents=(TH1F*)f->Get((path+"/Nevents").c_str());
931 // double Ntot =h_Nevents->GetEntries();
932 // if (Ntot!=0.) h_mass_scaled->Scale(1./Ntot);
933 // h_mass_scaled->SetTitle(title+" (per event)");
934 // h_mass_scaled->Write("Jpsi_invmass_scaled",TObject::kOverwrite);
935 // }
936 // }
937 // delete h_mass_scaled;
938  if (CheckHistogram(f, (path + "/Jpsi_invmass").c_str())) {
939  TH1F* h_mass_rebin = (TH1F*) (f->Get((path + "/Jpsi_invmass").c_str())->Clone("Jpsi_invmass_rebin"));
940  TString title = h_mass_rebin->GetTitle();
941  h_mass_rebin->SetMarkerStyle(21);
942  h_mass_rebin->Rebin(2);
943  h_mass_rebin->SetTitle(title + " (larger binning for low Stats.)");
944  h_mass_rebin->Write("Jpsi_invmass_rebin", TObject::kOverwrite);
945  }
946 
947  if (!CheckHistogram(f, (path + "/probe_all_pt").c_str())) return;
948 
949  TH1F* h_probe_all_pt = (TH1F*) (f->Get((path + "/probe_all_pt").c_str())->Clone());
950  if (!CheckHistogram(f, (path + "/probe_match_pt").c_str())) return;
951 
952  TH1F* h_probe_match_pt = (TH1F*) (f->Get((path + "/probe_match_pt").c_str())->Clone());
953  if (!CheckHistogram(f, (path + "/probe_all_eta").c_str())) return;
954 
955  TH1F* h_probe_all_eta = (TH1F*) (f->Get((path + "/probe_all_eta").c_str())->Clone());
956  if (!CheckHistogram(f, (path + "/probe_match_eta").c_str())) return;
957 
958  TH1F* h_probe_match_eta = (TH1F*) (f->Get((path + "/probe_match_eta").c_str())->Clone());
959  if (!CheckHistogram(f, (path + "/probe_all_phi").c_str())) return;
960 
961  TH1F* h_probe_all_phi = (TH1F*) (f->Get((path + "/probe_all_phi").c_str())->Clone());
962  if (!CheckHistogram(f, (path + "/probe_match_phi").c_str())) return;
963 
964  TH1F* h_probe_match_phi = (TH1F*) (f->Get((path + "/probe_match_phi").c_str())->Clone());
965  if (!CheckHistogram(f, (path + "/Muonplus_pt").c_str())) return;
966 
967  TH1F* h_ptplus = (TH1F*) (f->Get((path + "/Muonplus_pt").c_str())->Clone());
968  if (!CheckHistogram(f, (path + "/Muonminus_pt").c_str())) return;
969 
970  TH1F* h_ptminus = (TH1F*) (f->Get((path + "/Muonminus_pt").c_str())->Clone());
971 
972  char cpt[100], cz0[100], cphi[100], cphidiff[100], ceta[100], cetadiff[100], cmaxeta[100], ccrt[100], cinvpt[100],
973  cphiplus[100], cphiminus[100], cetaplus[100], cetaminus[100], ceta_b[100], ceta_ecc[100], ceta_eca[100],
974  cangle_eta[100], csumeta[100], csumabseta[100], csumphi[100];
975  for (int i = 0; i < nbins; i++) {
976  sprintf(cpt, (path + "/pt_bin%d").c_str(), i);
977  sprintf(cz0, (path + "/z0_bin%d").c_str(), i);
978  sprintf(cphi, (path + "/phi_bin%d").c_str(), i);
979  sprintf(cphiplus, (path + "/phiplus_bin%d").c_str(), i);
980  sprintf(cphiminus, (path + "/phiminus_bin%d").c_str(), i);
981  sprintf(cphidiff, (path + "/phidiff_bin%d").c_str(), i);
982  sprintf(ceta, (path + "/eta_bin%d").c_str(), i);
983  sprintf(cetaplus, (path + "/etaplus_bin%d").c_str(), i);
984  sprintf(cetaminus, (path + "/etaminus_bin%d").c_str(), i);
985  sprintf(cmaxeta, (path + "/maxeta_bin%d").c_str(), i);
986  sprintf(cetadiff, (path + "/etadiff_bin%d").c_str(), i);
987  sprintf(ccrt, (path + "/crt_bin%d").c_str(), i);
988  sprintf(cinvpt, (path + "/invpt_bin%d").c_str(), i);
989  sprintf(cangle_eta, (path + "/angle_eta_bin%d").c_str(), i);
990  sprintf(csumphi, (path + "/phi_sum%d").c_str(), i);
991  sprintf(csumeta, (path + "/eta_sum%d").c_str(), i);
992  sprintf(csumabseta, (path + "/eta_AbsSum%d").c_str(), i);
993 
994  if (!CheckHistogram(f, cpt)) return;
995 
996  if (!CheckHistogram(f, cz0)) return;
997 
998  if (!CheckHistogram(f, cphi)) return;
999 
1000  if (!CheckHistogram(f, cphiplus)) return;
1001 
1002  if (!CheckHistogram(f, cphiminus)) return;
1003 
1004  if (!CheckHistogram(f, cphidiff)) return;
1005 
1006  if (!CheckHistogram(f, ceta)) return;
1007 
1008  if (!CheckHistogram(f, cetaplus)) return;
1009 
1010  if (!CheckHistogram(f, cetaminus)) return;
1011 
1012  if (!CheckHistogram(f, cmaxeta)) return;
1013 
1014  if (!CheckHistogram(f, cetadiff)) return;
1015 
1016  if (!CheckHistogram(f, ccrt)) return;
1017 
1018  if (!CheckHistogram(f, cinvpt)) return;
1019 
1020  if (!CheckHistogram(f, cangle_eta)) return;
1021 
1022  if (!CheckHistogram(f, csumphi)) return;
1023 
1024  if (!CheckHistogram(f, csumeta)) return;
1025 
1026  if (!CheckHistogram(f, csumabseta)) return;
1027 
1028  hpt[i] = (TH1F*) (f->Get(cpt)->Clone());
1029  hz0[i] = (TH1F*) (f->Get(cz0)->Clone());
1030  hphi[i] = (TH1F*) (f->Get(cphi)->Clone());
1031  hphiplus[i] = (TH1F*) (f->Get(cphiplus)->Clone());
1032  hphiminus[i] = (TH1F*) (f->Get(cphiminus)->Clone());
1033  hphidiff[i] = (TH1F*) (f->Get(cphidiff)->Clone());
1034  heta[i] = (TH1F*) (f->Get(ceta)->Clone());
1035  hetaplus[i] = (TH1F*) (f->Get(cetaplus)->Clone());
1036  hetaminus[i] = (TH1F*) (f->Get(cetaminus)->Clone());
1037  hetadiff[i] = (TH1F*) (f->Get(cetadiff)->Clone());
1038  hmaxeta[i] = (TH1F*) (f->Get(cmaxeta)->Clone());
1039  hcrt[i] = (TH1F*) (f->Get(ccrt)->Clone());
1040  hinvpt[i] = (TH1F*) (f->Get(cinvpt)->Clone());
1041  hangle_eta[i] = (TH1F*) (f->Get(cangle_eta)->Clone());
1042  hsumphi[i] = (TH1F*) (f->Get(csumphi)->Clone());
1043  hsumeta[i] = (TH1F*) (f->Get(csumeta)->Clone());
1044  hsumabseta[i] = (TH1F*) (f->Get(csumabseta)->Clone());
1045 
1046  if (i < 2) {
1047  sprintf(ceta_b, (path + "/eta_b_bin%d").c_str(), i);
1048  sprintf(ceta_eca, (path + "/eta_eca_bin%d").c_str(), i);
1049  sprintf(ceta_ecc, (path + "/eta_ecc_bin%d").c_str(), i);
1050  if (!CheckHistogram(f, ceta_b)) return;
1051 
1052  if (!CheckHistogram(f, ceta_eca)) return;
1053 
1054  if (!CheckHistogram(f, ceta_ecc)) return;
1055 
1056  heta_b[i] = (TH1F*) (f->Get(ceta_b)->Clone());
1057  heta_ecc[i] = (TH1F*) (f->Get(ceta_ecc)->Clone());
1058  heta_eca[i] = (TH1F*) (f->Get(ceta_eca)->Clone());
1059  }
1060  }
1061  h_mass->SetMarkerStyle(21);
1062 
1063  TCanvas* myCanvas = new TCanvas("MyCanvas");
1064  myCanvas->cd();
1065 
1066 // h_mass->Fit(f1,"RQMN");
1067 
1068  fitJpsiHistograms(h_jpsi_invmass_vs_pt, h_jpsi_width_vs_pt, hpt, nbins);
1069  fitJpsiHistograms(h_jpsi_invmass_vs_z0, h_jpsi_width_vs_z0, hz0, nbins);
1070  fitJpsiHistograms(h_jpsi_invmass_vs_phi, h_jpsi_width_vs_phi, hphi, nbins);
1071  fitJpsiHistograms(h_jpsi_invmass_vs_phiplus, h_jpsi_width_vs_phiplus, hphiplus, nbins);
1072  fitJpsiHistograms(h_jpsi_invmass_vs_phiminus, h_jpsi_width_vs_phiminus, hphiminus, nbins);
1073  fitJpsiHistograms(h_jpsi_invmass_vs_phidiff, h_jpsi_width_vs_phidiff, hphidiff, nbins);
1074  fitJpsiHistograms(h_jpsi_invmass_vs_eta, h_jpsi_width_vs_eta, heta, nbins);
1075  fitJpsiHistograms(h_jpsi_invmass_vs_etaplus, h_jpsi_width_vs_etaplus, hetaplus, nbins);
1076  fitJpsiHistograms(h_jpsi_invmass_vs_etaminus, h_jpsi_width_vs_etaminus, hetaminus, nbins);
1077  fitJpsiHistograms(h_jpsi_invmass_vs_maxeta, h_jpsi_width_vs_maxeta, hmaxeta, nbins);
1078  fitJpsiHistograms(h_jpsi_invmass_vs_etadiff, h_jpsi_width_vs_etadiff, hetadiff, nbins);
1079  fitJpsiHistograms(h_jpsi_invmass_vs_crt, h_jpsi_width_vs_crt, hcrt, nbins);
1080  fitJpsiHistograms(h_jpsi_invmass_vs_invpt, h_jpsi_width_vs_invpt, hinvpt, nbins);
1081  fitJpsiHistograms(h_jpsi_invmass_vs_eta_barrel, h_jpsi_width_vs_eta_barrel, heta_b, 2);
1082  fitJpsiHistograms(h_jpsi_invmass_vs_eta_eca, h_jpsi_width_vs_eta_eca, heta_eca, 2);
1083  fitJpsiHistograms(h_jpsi_invmass_vs_eta_ecc, h_jpsi_width_vs_eta_ecc, heta_ecc, 2);
1084  fitJpsiHistograms(h_jpsi_invmass_vs_angle_eta, h_jpsi_width_vs_angle_eta, hangle_eta, nbins);
1085  fitJpsiHistograms(h_jpsi_invmass_vs_phisum, h_jpsi_width_vs_phisum, hsumphi, nbins);
1086  fitJpsiHistograms(h_jpsi_invmass_vs_sumeta, h_jpsi_width_vs_sumeta, hsumeta, nbins);
1087  fitJpsiHistograms(h_jpsi_invmass_vs_sumabseta, h_jpsi_width_vs_sumabseta, hsumabseta, nbins);
1088  if (h_eff_pt->GetNbinsX() == h_probe_match_pt->GetNbinsX()) {
1089  h_eff_pt->SetMarkerStyle(21);
1090  h_eff_eta->SetMarkerStyle(21);
1091  h_eff_phi->SetMarkerStyle(21);
1092  h_eff_pt->Divide(h_probe_match_pt, h_probe_all_pt, 1, 1, "B");
1093  h_eff_eta->Divide(h_probe_match_eta, h_probe_all_eta, 1, 1, "B");
1094  h_eff_phi->Divide(h_probe_match_phi, h_probe_all_phi, 1, 1, "B");
1095  }
1096  ProcessAsymHistograms(h_ptminus, h_ptplus, h_chargeasym_vs_pt);
1097  h_chargeasym_vs_pt->Write("", TObject::kOverwrite);
1098 
1099  // f->cd(path.c_str());
1100  if (f->cd(path.c_str()) == 0) {
1101  //std::cerr<< "MonitoringFile::fitMergedFile_IDPerfMonJpsi(): "
1102  //<<"No such directory \""<< path << "\"\n";
1103  return;
1104  }
1105 
1106  h_mass->Write("", TObject::kOverwrite);
1107  for (int i = 0; i < nbins; i++) {
1108  hpt[i]->Write("", TObject::kOverwrite);
1109  hz0[i]->Write("", TObject::kOverwrite);
1110  hphi[i]->Write("", TObject::kOverwrite);
1111  hphiplus[i]->Write("", TObject::kOverwrite);
1112  hphiminus[i]->Write("", TObject::kOverwrite);
1113  hphidiff[i]->Write("", TObject::kOverwrite);
1114  heta[i]->Write("", TObject::kOverwrite);
1115  hetadiff[i]->Write("", TObject::kOverwrite);
1116  hmaxeta[i]->Write("", TObject::kOverwrite);
1117  hinvpt[i]->Write("", TObject::kOverwrite);
1118  hcrt[i]->Write("", TObject::kOverwrite);
1119  hetaplus[i]->Write("", TObject::kOverwrite);
1120  hetaminus[i]->Write("", TObject::kOverwrite);
1121  hangle_eta[i]->Write("", TObject::kOverwrite);
1122  hsumphi[i]->Write("", TObject::kOverwrite);
1123  hsumeta[i]->Write("", TObject::kOverwrite);
1124  hsumabseta[i]->Write("", TObject::kOverwrite);
1125  if (i < 2) {
1126  heta_b[i]->Write("", TObject::kOverwrite);
1127  heta_ecc[i]->Write("", TObject::kOverwrite);
1128  heta_eca[i]->Write("", TObject::kOverwrite);
1129  }
1130  }
1131 
1132  h_jpsi_invmass_vs_pt->Write("", TObject::kOverwrite);
1133  h_jpsi_invmass_vs_z0->Write("", TObject::kOverwrite);
1134  h_jpsi_invmass_vs_phi->Write("", TObject::kOverwrite);
1135  h_jpsi_invmass_vs_phiplus->Write("", TObject::kOverwrite);
1136  h_jpsi_invmass_vs_phiminus->Write("", TObject::kOverwrite);
1137  h_jpsi_invmass_vs_phidiff->Write("", TObject::kOverwrite);
1138  h_jpsi_invmass_vs_eta->Write("", TObject::kOverwrite);
1139  h_jpsi_invmass_vs_eta_barrel->Write("", TObject::kOverwrite);
1140  h_jpsi_invmass_vs_eta_ecc->Write("", TObject::kOverwrite);
1141  h_jpsi_invmass_vs_eta_eca->Write("", TObject::kOverwrite);
1142  h_jpsi_invmass_vs_etadiff->Write("", TObject::kOverwrite);
1143  h_jpsi_invmass_vs_etaplus->Write("", TObject::kOverwrite);
1144  h_jpsi_invmass_vs_etaminus->Write("", TObject::kOverwrite);
1145  h_jpsi_invmass_vs_maxeta->Write("", TObject::kOverwrite);
1146  h_jpsi_invmass_vs_crt->Write("", TObject::kOverwrite);
1147  h_jpsi_invmass_vs_invpt->Write("", TObject::kOverwrite);
1148  h_jpsi_invmass_vs_angle_eta->Write("", TObject::kOverwrite);
1149  h_jpsi_invmass_vs_phisum->Write("", TObject::kOverwrite);
1150  h_jpsi_invmass_vs_sumeta->Write("", TObject::kOverwrite);
1151  h_jpsi_invmass_vs_sumabseta->Write("", TObject::kOverwrite);
1152 
1153  h_jpsi_width_vs_pt->Write("", TObject::kOverwrite);
1154  h_jpsi_width_vs_z0->Write("", TObject::kOverwrite);
1155  h_jpsi_width_vs_phi->Write("", TObject::kOverwrite);
1156  h_jpsi_width_vs_phiplus->Write("", TObject::kOverwrite);
1157  h_jpsi_width_vs_phiminus->Write("", TObject::kOverwrite);
1158  h_jpsi_width_vs_phidiff->Write("", TObject::kOverwrite);
1159  h_jpsi_width_vs_eta->Write("", TObject::kOverwrite);
1160  h_jpsi_width_vs_eta_barrel->Write("", TObject::kOverwrite);
1161  h_jpsi_width_vs_eta_ecc->Write("", TObject::kOverwrite);
1162  h_jpsi_width_vs_eta_eca->Write("", TObject::kOverwrite);
1163  h_jpsi_width_vs_etadiff->Write("", TObject::kOverwrite);
1164  h_jpsi_width_vs_etaplus->Write("", TObject::kOverwrite);
1165  h_jpsi_width_vs_etaminus->Write("", TObject::kOverwrite);
1166  h_jpsi_width_vs_maxeta->Write("", TObject::kOverwrite);
1167  h_jpsi_width_vs_crt->Write("", TObject::kOverwrite);
1168  h_jpsi_width_vs_invpt->Write("", TObject::kOverwrite);
1169  h_jpsi_width_vs_angle_eta->Write("", TObject::kOverwrite);
1170  h_jpsi_width_vs_phisum->Write("", TObject::kOverwrite);
1171  h_jpsi_width_vs_sumeta->Write("", TObject::kOverwrite);
1172  h_jpsi_width_vs_sumabseta->Write("", TObject::kOverwrite);
1173 
1174  h_eff_pt->Write("", TObject::kOverwrite);
1175  h_eff_eta->Write("", TObject::kOverwrite);
1176  h_eff_phi->Write("", TObject::kOverwrite);
1177 
1178 
1179 
1180  myCanvas->Close();
1181  delete myCanvas;
1182 
1183  f->Write();
1184 
1185 // delete f1;
1186  }

◆ fitMergedFile_IDPerfMonKshort()

void dqutils::MonitoringFile::fitMergedFile_IDPerfMonKshort ( TFile *  f,
const std::string &  run_dir,
const std::string &  TriggerName 
)
static

Definition at line 300 of file MonitoringFile_IDPerfPostProcess.cxx.

301  {
302  std::string path;
303  path = run_dir + "IDPerfMon/Kshort/" + TriggerName;
304  if (f->cd(path.c_str()) == 0) {
305  //std::cerr << "MonitoringFile::fitMergedFile_IDPerfMonKshort(): "
306  //<< "No such directory \"" << path << "\"\n";
307  return;
308  }
309 
310  Double_t myPi = TMath::Pi();
311 
312  TH1F* h_massVPtBinFittedHistos[5];
313  TH1F* h_massVRadiusBinFittedHistos[7];
314  TH1F* h_massVEtaBinHistos[10];
315  TH1F* h_massVPhiBinHistos[10];
316  TH1F* h_massVCurvatureDiffBinHistos[6];
317 
318  if (!CheckHistogram(f, (path + "/ks_mass").c_str())) return;
319 
320  if (!CheckHistogram(f, (path + "/MassVptBinFitted0").c_str())) return;
321 
322  if (!CheckHistogram(f, (path + "/MassVptBinFitted1").c_str())) return;
323 
324  if (!CheckHistogram(f, (path + "/MassVptBinFitted2").c_str())) return;
325 
326  if (!CheckHistogram(f, (path + "/MassVptBinFitted3").c_str())) return;
327 
328  if (!CheckHistogram(f, (path + "/MassVptBinFitted4").c_str())) return;
329 
330  if (!CheckHistogram(f, (path + "/MassVradiusBinFitted0").c_str())) return;
331 
332  if (!CheckHistogram(f, (path + "/MassVradiusBinFitted1").c_str())) return;
333 
334  if (!CheckHistogram(f, (path + "/MassVradiusBinFitted2").c_str())) return;
335 
336  if (!CheckHistogram(f, (path + "/MassVradiusBinFitted3").c_str())) return;
337 
338  if (!CheckHistogram(f, (path + "/MassVradiusBinFitted4").c_str())) return;
339 
340  if (!CheckHistogram(f, (path + "/MassVradiusBinFitted5").c_str())) return;
341 
342  if (!CheckHistogram(f, (path + "/MassVradiusBinFitted6").c_str())) return;
343 
344  if (!CheckHistogram(f, (path + "/MassVEtaBin0").c_str())) return;
345 
346  if (!CheckHistogram(f, (path + "/MassVEtaBin1").c_str())) return;
347 
348  if (!CheckHistogram(f, (path + "/MassVEtaBin2").c_str())) return;
349 
350  if (!CheckHistogram(f, (path + "/MassVEtaBin3").c_str())) return;
351 
352  if (!CheckHistogram(f, (path + "/MassVEtaBin4").c_str())) return;
353 
354  if (!CheckHistogram(f, (path + "/MassVEtaBin5").c_str())) return;
355 
356  if (!CheckHistogram(f, (path + "/MassVEtaBin6").c_str())) return;
357 
358  if (!CheckHistogram(f, (path + "/MassVEtaBin7").c_str())) return;
359 
360  if (!CheckHistogram(f, (path + "/MassVEtaBin8").c_str())) return;
361 
362  if (!CheckHistogram(f, (path + "/MassVEtaBin9").c_str())) return;
363 
364  if (!CheckHistogram(f, (path + "/MassVPhiBin0").c_str())) return;
365 
366  if (!CheckHistogram(f, (path + "/MassVPhiBin1").c_str())) return;
367 
368  if (!CheckHistogram(f, (path + "/MassVPhiBin2").c_str())) return;
369 
370  if (!CheckHistogram(f, (path + "/MassVPhiBin3").c_str())) return;
371 
372  if (!CheckHistogram(f, (path + "/MassVPhiBin4").c_str())) return;
373 
374  if (!CheckHistogram(f, (path + "/MassVPhiBin5").c_str())) return;
375 
376  if (!CheckHistogram(f, (path + "/MassVPhiBin6").c_str())) return;
377 
378  if (!CheckHistogram(f, (path + "/MassVPhiBin7").c_str())) return;
379 
380  if (!CheckHistogram(f, (path + "/MassVPhiBin8").c_str())) return;
381 
382  if (!CheckHistogram(f, (path + "/MassVPhiBin9").c_str())) return;
383 
384  if (!CheckHistogram(f, (path + "/MassVCurvatureDiffBin0").c_str())) return;
385 
386  if (!CheckHistogram(f, (path + "/MassVCurvatureDiffBin1").c_str())) return;
387 
388  if (!CheckHistogram(f, (path + "/MassVCurvatureDiffBin2").c_str())) return;
389 
390  if (!CheckHistogram(f, (path + "/MassVCurvatureDiffBin3").c_str())) return;
391 
392  if (!CheckHistogram(f, (path + "/MassVCurvatureDiffBin4").c_str())) return;
393 
394  if (!CheckHistogram(f, (path + "/MassVCurvatureDiffBin5").c_str())) return;
395 
396  TH1F* h_mass = (TH1F*) (f->Get((path + "/ks_mass").c_str())->Clone());
397  if (CheckHistogram(f, (path + "/Nevents").c_str())) {
398  TH1F* h_Nevents = (TH1F*) f->Get((path + "/Nevents").c_str());
399  TH1F* h_rate = new TH1F("rate", "production rate", 1, 0, 1);
400  double Ntot = h_Nevents->GetEntries();
401  double yield = h_mass->Integral(h_mass->FindBin(0.487), h_mass->FindBin(0.507));
402  double rate = yield / Ntot;
403  double rate_error = sqrt(1 / yield + 1 / Ntot) * yield / Ntot;
404  h_rate->SetBinContent(1, rate);
405  h_rate->SetBinError(1, rate_error);
406  h_rate->Write("", TObject::kOverwrite);
407  }
408 // TH1F* h_mass_scaled = (TH1F*)(f->Get((path+"/ks_mass").c_str())->Clone("ks_mass_scaled_copy"));
409 // TString title(h_mass_scaled->GetTitle());
410 // if (CheckHistogram(f,(path+"/ks_mass_scaled").c_str())) {
411 // if (CheckHistogram(f,(path+"/Nevents").c_str())) {
412 // TH1F* h_Nevents=(TH1F*)f->Get((path+"/Nevents").c_str());
413 // double Ntot =h_Nevents->GetEntries();
414 // if (Ntot!=0.) h_mass_scaled->Scale(1./Ntot);
415 // h_mass_scaled->SetTitle(title+" (per event)");
416 // h_mass_scaled->Write("ks_mass_scaled",TObject::kOverwrite);
417 // }
418 // }
419 // delete h_mass_scaled;
420 
421  h_massVPtBinFittedHistos[0] = (TH1F*) (f->Get((path + "/MassVptBinFitted0").c_str())->Clone());
422  h_massVPtBinFittedHistos[1] = (TH1F*) (f->Get((path + "/MassVptBinFitted1").c_str())->Clone());
423  h_massVPtBinFittedHistos[2] = (TH1F*) (f->Get((path + "/MassVptBinFitted2").c_str())->Clone());
424  h_massVPtBinFittedHistos[3] = (TH1F*) (f->Get((path + "/MassVptBinFitted3").c_str())->Clone());
425  h_massVPtBinFittedHistos[4] = (TH1F*) (f->Get((path + "/MassVptBinFitted4").c_str())->Clone());
426  h_massVRadiusBinFittedHistos[0] = (TH1F*) (f->Get((path + "/MassVradiusBinFitted0").c_str())->Clone());
427  h_massVRadiusBinFittedHistos[1] = (TH1F*) (f->Get((path + "/MassVradiusBinFitted1").c_str())->Clone());
428  h_massVRadiusBinFittedHistos[2] = (TH1F*) (f->Get((path + "/MassVradiusBinFitted2").c_str())->Clone());
429  h_massVRadiusBinFittedHistos[3] = (TH1F*) (f->Get((path + "/MassVradiusBinFitted3").c_str())->Clone());
430  h_massVRadiusBinFittedHistos[4] = (TH1F*) (f->Get((path + "/MassVradiusBinFitted4").c_str())->Clone());
431  h_massVRadiusBinFittedHistos[5] = (TH1F*) (f->Get((path + "/MassVradiusBinFitted5").c_str())->Clone());
432  h_massVRadiusBinFittedHistos[6] = (TH1F*) (f->Get((path + "/MassVradiusBinFitted6").c_str())->Clone());
433  h_massVEtaBinHistos[0] = (TH1F*) (f->Get((path + "/MassVEtaBin0").c_str())->Clone());
434  h_massVEtaBinHistos[1] = (TH1F*) (f->Get((path + "/MassVEtaBin1").c_str())->Clone());
435  h_massVEtaBinHistos[2] = (TH1F*) (f->Get((path + "/MassVEtaBin2").c_str())->Clone());
436  h_massVEtaBinHistos[3] = (TH1F*) (f->Get((path + "/MassVEtaBin3").c_str())->Clone());
437  h_massVEtaBinHistos[4] = (TH1F*) (f->Get((path + "/MassVEtaBin4").c_str())->Clone());
438  h_massVEtaBinHistos[5] = (TH1F*) (f->Get((path + "/MassVEtaBin5").c_str())->Clone());
439  h_massVEtaBinHistos[6] = (TH1F*) (f->Get((path + "/MassVEtaBin6").c_str())->Clone());
440  h_massVEtaBinHistos[7] = (TH1F*) (f->Get((path + "/MassVEtaBin7").c_str())->Clone());
441  h_massVEtaBinHistos[8] = (TH1F*) (f->Get((path + "/MassVEtaBin8").c_str())->Clone());
442  h_massVEtaBinHistos[9] = (TH1F*) (f->Get((path + "/MassVEtaBin9").c_str())->Clone());
443  h_massVPhiBinHistos[0] = (TH1F*) (f->Get((path + "/MassVPhiBin0").c_str())->Clone());
444  h_massVPhiBinHistos[1] = (TH1F*) (f->Get((path + "/MassVPhiBin1").c_str())->Clone());
445  h_massVPhiBinHistos[2] = (TH1F*) (f->Get((path + "/MassVPhiBin2").c_str())->Clone());
446  h_massVPhiBinHistos[3] = (TH1F*) (f->Get((path + "/MassVPhiBin3").c_str())->Clone());
447  h_massVPhiBinHistos[4] = (TH1F*) (f->Get((path + "/MassVPhiBin4").c_str())->Clone());
448  h_massVPhiBinHistos[5] = (TH1F*) (f->Get((path + "/MassVPhiBin5").c_str())->Clone());
449  h_massVPhiBinHistos[6] = (TH1F*) (f->Get((path + "/MassVPhiBin6").c_str())->Clone());
450  h_massVPhiBinHistos[7] = (TH1F*) (f->Get((path + "/MassVPhiBin7").c_str())->Clone());
451  h_massVPhiBinHistos[8] = (TH1F*) (f->Get((path + "/MassVPhiBin8").c_str())->Clone());
452  h_massVPhiBinHistos[9] = (TH1F*) (f->Get((path + "/MassVPhiBin9").c_str())->Clone());
453  h_massVCurvatureDiffBinHistos[0] = (TH1F*) (f->Get((path + "/MassVCurvatureDiffBin0").c_str())->Clone());
454  h_massVCurvatureDiffBinHistos[1] = (TH1F*) (f->Get((path + "/MassVCurvatureDiffBin1").c_str())->Clone());
455  h_massVCurvatureDiffBinHistos[2] = (TH1F*) (f->Get((path + "/MassVCurvatureDiffBin2").c_str())->Clone());
456  h_massVCurvatureDiffBinHistos[3] = (TH1F*) (f->Get((path + "/MassVCurvatureDiffBin3").c_str())->Clone());
457  h_massVCurvatureDiffBinHistos[4] = (TH1F*) (f->Get((path + "/MassVCurvatureDiffBin4").c_str())->Clone());
458  h_massVCurvatureDiffBinHistos[5] = (TH1F*) (f->Get((path + "/MassVCurvatureDiffBin5").c_str())->Clone());
459 
460  TF1* func1 = new TF1("func1", "gaus", 0.460, 0.540);
461  TF1* func2 = new TF1("func2", "expo", 0.460, 0.540);
462  TF1* func = new TF1("func", "func1+func2", 0.460, 0.540);
463 
464  func->SetLineColor(4);
465  func->SetParameters(10., 0.500, 0.010, 2., -.001);
466  // func->SetParLimits(0,0.,10000.);
467  func->SetParLimits(1, 0.460, 0.540);
468  func->SetParLimits(2, 0., 0.100);
469  func->SetParLimits(3, 0., 10000.);
470  func->SetParLimits(4, -1000., 0.);
471  func->SetParNames("Constant", "Mean", "Sigma", "Constant", "Slope");
472 
473  TCanvas* myCanvas = new TCanvas("MyCanvas");
474  myCanvas->cd();
475 
476  h_mass->Fit(func, "lmhqnr");
477 
478  Double_t massBins[5], massErrorBins[5], widthBins[5], widthErrorBins[5];
479  const Int_t nPtBinsHisto = 5 + 1;
480  Double_t ptBins[nPtBinsHisto] = {
481  0.5, 1.6, 2.1, 2.8, 3.9, 5.1
482  };
483  for (int binFill = 0; binFill < 5; binFill++) {
484  double max = h_massVPtBinFittedHistos[binFill]->GetBinContent(h_massVPtBinFittedHistos[binFill]->GetMaximumBin());
485  func->SetParLimits(0, 0, 2 * max);
486  h_massVPtBinFittedHistos[binFill]->Fit(func, "lmhqr");
487  massBins[binFill] = func->GetParameter(1);
488  massErrorBins[binFill] = func->GetParError(1);
489  widthBins[binFill] = func->GetParameter(2);
490  widthErrorBins[binFill] = func->GetParError(2);
491  }
492 
493  const Double_t* ptBinsFinal = ptBins;
494  const Double_t* massBinsFinal = massBins;
495  const Double_t* massErrorBinsFinal = massErrorBins;
496  const Double_t* widthBinsFinal = widthBins;
497  const Double_t* widthErrorBinsFinal = widthErrorBins;
498 
499  TH1F* h_massVersusPt = new TH1F("KsMassVersusPt_Merged", "", 5, ptBinsFinal);
500  h_massVersusPt->SetXTitle("p_{T} (Gev / c)");
501  h_massVersusPt->SetYTitle("Mass (Gev / c^{2})");
502  h_massVersusPt->SetMarkerStyle(20);
503  for (int binFill = 0; binFill < 5; binFill++) {
504  Double_t binContent = massBinsFinal[binFill];
505  Double_t binError = massErrorBinsFinal[binFill];
506  h_massVersusPt->SetBinContent(binFill + 1, binContent);
507  h_massVersusPt->SetBinError(binFill + 1, binError);
508  }
509 
510  TH1F* h_widthVersusPt = new TH1F("KsWidthVersusPt_Merged", "", 5, ptBinsFinal);
511  h_widthVersusPt->SetXTitle("p_{T} (Gev / c)");
512  h_widthVersusPt->SetYTitle("Width (Gev / c^{2})");
513  h_widthVersusPt->SetMarkerStyle(20);
514  for (int binFill = 0; binFill < 5; binFill++) {
515  Double_t binContent = widthBinsFinal[binFill];
516  Double_t binError = widthErrorBinsFinal[binFill];
517  h_widthVersusPt->SetBinContent(binFill + 1, binContent);
518  h_widthVersusPt->SetBinError(binFill + 1, binError);
519  }
520 
521  Double_t massVradiusBins[7], massVradiusErrorBins[7], widthVradiusBins[7], widthVradiusErrorBins[7];
522  const Int_t nRadiusBinsHisto = 7 + 1;
523  Double_t radiusBins[nRadiusBinsHisto] = {
524  0., 30., 40., 60., 80., 100., 140., 230
525  };
526  for (int binFill = 0; binFill < 7; binFill++) {
527  double max = h_massVRadiusBinFittedHistos[binFill]->GetBinContent(
528  h_massVRadiusBinFittedHistos[binFill]->GetMaximumBin());
529  func->SetParLimits(0, 0, 2 * max);
530  h_massVRadiusBinFittedHistos[binFill]->Fit(func, "lmhqr");
531  massVradiusBins[binFill] = func->GetParameter(1);
532  massVradiusErrorBins[binFill] = func->GetParError(1);
533  widthVradiusBins[binFill] = func->GetParameter(2);
534  widthVradiusErrorBins[binFill] = func->GetParError(2);
535  }
536 
537  const Double_t* radiusBinsFinal = radiusBins;
538  const Double_t* massVradiusBinsFinal = massVradiusBins;
539  const Double_t* massVradiusErrorBinsFinal = massVradiusErrorBins;
540  const Double_t* widthVradiusBinsFinal = widthVradiusBins;
541  const Double_t* widthVradiusErrorBinsFinal = widthVradiusErrorBins;
542 
543  TH1F* h_massVersusRadius = new TH1F("KsMassVersusRadius_Merged", "", 7, radiusBinsFinal);
544  h_massVersusRadius->SetXTitle("Decay Radius (mm)");
545  h_massVersusRadius->SetYTitle("Mass (Gev / c^{2})");
546  h_massVersusRadius->SetMarkerStyle(20);
547  for (int binFill = 0; binFill < 7; binFill++) {
548  Double_t binContent = massVradiusBinsFinal[binFill];
549  Double_t binError = massVradiusErrorBinsFinal[binFill];
550  h_massVersusRadius->SetBinContent(binFill + 1, binContent);
551  h_massVersusRadius->SetBinError(binFill + 1, binError);
552  }
553  TH1F* h_widthVersusRadius = new TH1F("KsWidthVersusRadius_Merged", "", 7, radiusBinsFinal);
554  h_widthVersusRadius->SetXTitle("Decay Radius (mm)");
555  h_widthVersusRadius->SetYTitle("Width (Gev / c^{2})");
556  h_widthVersusRadius->SetMarkerStyle(20);
557  for (int binFill = 0; binFill < 7; binFill++) {
558  Double_t binContent = widthVradiusBinsFinal[binFill];
559  Double_t binError = widthVradiusErrorBinsFinal[binFill];
560  h_widthVersusRadius->SetBinContent(binFill + 1, binContent);
561  h_widthVersusRadius->SetBinError(binFill + 1, binError);
562  }
563 
564  Double_t etaBins[11] = {
565  -2.5, -2.0, -1.5, -1.0, -0.5, 0.0, 0.5, 1.0, 1.5, 2.0, 2.5
566  };
567  Double_t massVetaBins[10], massVetaErrorBins[10], widthVetaBins[10], widthVetaErrorBins[10];
568  for (int binFill = 0; binFill < 10; binFill++) {
569  double max = h_massVEtaBinHistos[binFill]->GetBinContent(h_massVEtaBinHistos[binFill]->GetMaximumBin());
570  func->SetParLimits(0, 0, 2 * max);
571  h_massVEtaBinHistos[binFill]->Fit(func, "lmhqr");
572  massVetaBins[binFill] = func->GetParameter(1);
573  massVetaErrorBins[binFill] = func->GetParError(1);
574  widthVetaBins[binFill] = func->GetParameter(2);
575  widthVetaErrorBins[binFill] = func->GetParError(2);
576  }
577  TH1F* h_massVersusEta = new TH1F("KsMassVersusEta_Merged", "", 10, etaBins);
578  h_massVersusEta->SetXTitle("#eta");
579  h_massVersusEta->SetYTitle("Mass (Gev / c^{2})");
580  h_massVersusEta->SetMarkerStyle(20);
581  for (int binFill = 0; binFill < 10; binFill++) {
582  Double_t binContent = massVetaBins[binFill];
583  Double_t binError = massVetaErrorBins[binFill];
584  h_massVersusEta->SetBinContent(binFill + 1, binContent);
585  h_massVersusEta->SetBinError(binFill + 1, binError);
586  }
587  TH1F* h_widthVersusEta = new TH1F("KsWidthVersusEta_Merged", "", 10, etaBins);
588  h_widthVersusEta->SetXTitle("#eta");
589  h_widthVersusEta->SetYTitle("Width (Gev / c^{2})");
590  h_widthVersusEta->SetMarkerStyle(20);
591  for (int binFill = 0; binFill < 10; binFill++) {
592  Double_t binContent = widthVetaBins[binFill];
593  Double_t binError = widthVetaErrorBins[binFill];
594  h_widthVersusEta->SetBinContent(binFill + 1, binContent);
595  h_widthVersusEta->SetBinError(binFill + 1, binError);
596  }
597 
598  Double_t phiBins[11] = {
599  (-5.0 * myPi / 5),
600  (-4.0 * myPi / 5),
601  (-3.0 * myPi / 5),
602  (-2.0 * myPi / 5),
603  (-1.0 * myPi / 5),
604  (0.0 * myPi / 5),
605  (1.0 * myPi / 5),
606  (2.0 * myPi / 5),
607  (3.0 * myPi / 5),
608  (4.0 * myPi / 5),
609  (5.0 * myPi / 5)
610  };
611  Double_t massVphiBins[10], massVphiErrorBins[10], widthVphiBins[10], widthVphiErrorBins[10];
612  for (int binFill = 0; binFill < 10; binFill++) {
613  double max = h_massVPhiBinHistos[binFill]->GetBinContent(h_massVPhiBinHistos[binFill]->GetMaximumBin());
614  func->SetParLimits(0, 0, 2 * max);
615  h_massVPhiBinHistos[binFill]->Fit(func, "lmhqr");
616  massVphiBins[binFill] = func->GetParameter(1);
617  massVphiErrorBins[binFill] = func->GetParError(1);
618  widthVphiBins[binFill] = func->GetParameter(2);
619  widthVphiErrorBins[binFill] = func->GetParError(2);
620  }
621  TH1F* h_massVersusPhi = new TH1F("KsMassVersusPhi_Merged", "", 10, phiBins);
622  h_massVersusPhi->SetXTitle("#phi");
623  h_massVersusPhi->SetYTitle("Mass (Gev / c^{2})");
624  h_massVersusPhi->SetMarkerStyle(20);
625  for (int binFill = 0; binFill < 10; binFill++) {
626  Double_t binContent = massVphiBins[binFill];
627  Double_t binError = massVphiErrorBins[binFill];
628  h_massVersusPhi->SetBinContent(binFill + 1, binContent);
629  h_massVersusPhi->SetBinError(binFill + 1, binError);
630  }
631  TH1F* h_widthVersusPhi = new TH1F("KsWidthVersusPhi_Merged", "", 10, phiBins);
632  h_widthVersusPhi->SetXTitle("#phi");
633  h_widthVersusPhi->SetYTitle("Width (Gev / c^{2})");
634  h_widthVersusPhi->SetMarkerStyle(20);
635  for (int binFill = 0; binFill < 10; binFill++) {
636  Double_t binContent = widthVphiBins[binFill];
637  Double_t binError = widthVphiErrorBins[binFill];
638  h_widthVersusPhi->SetBinContent(binFill + 1, binContent);
639  h_widthVersusPhi->SetBinError(binFill + 1, binError);
640  }
641 
642  Double_t curvatureDiffBins[7] = {
643  -0.0012, -0.0008, -0.0004, 0.0000, 0.0004, 0.0008, 0.0012
644  };
645  Double_t massVcurvatureDiffBins[6], massVcurvatureDiffErrorBins[6], widthVcurvatureDiffBins[6],
646  widthVcurvatureDiffErrorBins[6];
647  for (int binFill = 0; binFill < 6; binFill++) {
648  double max = h_massVCurvatureDiffBinHistos[binFill]->GetBinContent(
649  h_massVCurvatureDiffBinHistos[binFill]->GetMaximumBin());
650  func->SetParLimits(0, 0, 2 * max);
651  h_massVCurvatureDiffBinHistos[binFill]->Fit(func, "lmhqr");
652  massVcurvatureDiffBins[binFill] = func->GetParameter(1);
653  massVcurvatureDiffErrorBins[binFill] = func->GetParError(1);
654  widthVcurvatureDiffBins[binFill] = func->GetParameter(2);
655  widthVcurvatureDiffErrorBins[binFill] = func->GetParError(2);
656  }
657  TH1F* h_massVersusCurvatureDiff = new TH1F("KsMassVersusCurvatureDiff_Merged", "", 6, curvatureDiffBins);
658  h_massVersusCurvatureDiff->SetXTitle("1/p_{T}(#pi^{+}) - 1/p_{T}(#pi^{-}) [GeV^{-1}]");
659  h_massVersusCurvatureDiff->SetYTitle("Mass (Gev / c^{2})");
660  h_massVersusCurvatureDiff->SetMarkerStyle(20);
661  for (int binFill = 0; binFill < 6; binFill++) {
662  Double_t binContent = massVcurvatureDiffBins[binFill];
663  Double_t binError = massVcurvatureDiffErrorBins[binFill];
664  h_massVersusCurvatureDiff->SetBinContent(binFill + 1, binContent);
665  h_massVersusCurvatureDiff->SetBinError(binFill + 1, binError);
666  }
667  TH1F* h_widthVersusCurvatureDiff = new TH1F("KsWidthVersusCurvatureDiff_Merged", "", 6, curvatureDiffBins);
668  h_widthVersusCurvatureDiff->SetXTitle("1/p_{T}(#pi^{+}) - 1/p_{T}(#pi^{-}) [GeV^{-1}]");
669  h_widthVersusCurvatureDiff->SetYTitle("Width (Gev / c^{2})");
670  h_widthVersusCurvatureDiff->SetMarkerStyle(20);
671  for (int binFill = 0; binFill < 6; binFill++) {
672  Double_t binContent = widthVcurvatureDiffBins[binFill];
673  Double_t binError = widthVcurvatureDiffErrorBins[binFill];
674  h_widthVersusCurvatureDiff->SetBinContent(binFill + 1, binContent);
675  h_widthVersusCurvatureDiff->SetBinError(binFill + 1, binError);
676  }
677 
678  if (f->cd(path.c_str()) == 0) {
679  //std::cerr << "MonitoringFile::fitMergedFile_IDPerfMonKshort(): "
680  //<< "No such directory \"" << path << "\"\n";
681  return;
682  }
683 
684  // f->cd(path.c_str());
685 
686  h_mass->Write("", TObject::kOverwrite);
687 
688  h_massVPtBinFittedHistos[0]->Write("", TObject::kOverwrite);
689  h_massVPtBinFittedHistos[1]->Write("", TObject::kOverwrite);
690  h_massVPtBinFittedHistos[2]->Write("", TObject::kOverwrite);
691  h_massVPtBinFittedHistos[3]->Write("", TObject::kOverwrite);
692  h_massVPtBinFittedHistos[4]->Write("", TObject::kOverwrite);
693  h_massVRadiusBinFittedHistos[0]->Write("", TObject::kOverwrite);
694  h_massVRadiusBinFittedHistos[1]->Write("", TObject::kOverwrite);
695  h_massVRadiusBinFittedHistos[2]->Write("", TObject::kOverwrite);
696  h_massVRadiusBinFittedHistos[3]->Write("", TObject::kOverwrite);
697  h_massVRadiusBinFittedHistos[4]->Write("", TObject::kOverwrite);
698  h_massVRadiusBinFittedHistos[5]->Write("", TObject::kOverwrite);
699  h_massVRadiusBinFittedHistos[6]->Write("", TObject::kOverwrite);
700  h_massVEtaBinHistos[0]->Write("", TObject::kOverwrite);
701  h_massVEtaBinHistos[1]->Write("", TObject::kOverwrite);
702  h_massVEtaBinHistos[2]->Write("", TObject::kOverwrite);
703  h_massVEtaBinHistos[3]->Write("", TObject::kOverwrite);
704  h_massVEtaBinHistos[4]->Write("", TObject::kOverwrite);
705  h_massVEtaBinHistos[5]->Write("", TObject::kOverwrite);
706  h_massVEtaBinHistos[6]->Write("", TObject::kOverwrite);
707  h_massVEtaBinHistos[7]->Write("", TObject::kOverwrite);
708  h_massVEtaBinHistos[8]->Write("", TObject::kOverwrite);
709  h_massVEtaBinHistos[9]->Write("", TObject::kOverwrite);
710  h_massVPhiBinHistos[0]->Write("", TObject::kOverwrite);
711  h_massVPhiBinHistos[1]->Write("", TObject::kOverwrite);
712  h_massVPhiBinHistos[2]->Write("", TObject::kOverwrite);
713  h_massVPhiBinHistos[3]->Write("", TObject::kOverwrite);
714  h_massVPhiBinHistos[4]->Write("", TObject::kOverwrite);
715  h_massVPhiBinHistos[5]->Write("", TObject::kOverwrite);
716  h_massVPhiBinHistos[6]->Write("", TObject::kOverwrite);
717  h_massVPhiBinHistos[7]->Write("", TObject::kOverwrite);
718  h_massVPhiBinHistos[8]->Write("", TObject::kOverwrite);
719  h_massVPhiBinHistos[9]->Write("", TObject::kOverwrite);
720  h_massVCurvatureDiffBinHistos[0]->Write("", TObject::kOverwrite);
721  h_massVCurvatureDiffBinHistos[1]->Write("", TObject::kOverwrite);
722  h_massVCurvatureDiffBinHistos[2]->Write("", TObject::kOverwrite);
723  h_massVCurvatureDiffBinHistos[3]->Write("", TObject::kOverwrite);
724  h_massVCurvatureDiffBinHistos[4]->Write("", TObject::kOverwrite);
725  h_massVCurvatureDiffBinHistos[5]->Write("", TObject::kOverwrite);
726 
727  h_massVersusPt->Write("", TObject::kOverwrite);
728  h_widthVersusPt->Write("", TObject::kOverwrite);
729  h_massVersusRadius->Write("", TObject::kOverwrite);
730  h_widthVersusRadius->Write("", TObject::kOverwrite);
731  h_massVersusEta->Write("", TObject::kOverwrite);
732  h_widthVersusEta->Write("", TObject::kOverwrite);
733  h_massVersusPhi->Write("", TObject::kOverwrite);
734  h_widthVersusPhi->Write("", TObject::kOverwrite);
735  h_massVersusCurvatureDiff->Write("", TObject::kOverwrite);
736  h_widthVersusCurvatureDiff->Write("", TObject::kOverwrite);
737 
738  myCanvas->Close();
739  delete myCanvas;
740 
741  f->Write();
742 
743  delete func;
744  delete func1;
745  delete func2;
746  }

◆ fitMergedFile_IDPerfMonManager()

void dqutils::MonitoringFile::fitMergedFile_IDPerfMonManager ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Methods for creating ID Alignment summary plots on merged files.

Definition at line 37 of file MonitoringFile_IDPerfPostProcess.cxx.

38  {
39  //std::cout << "\n";
40  //std::cout << "Running Inner-Detector performance-monitoring analysis\n";
41  //std::cout << "\nWarning messages from fitting and histogram updating follow:\n\n";
42 
43  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
44 
45  if (f == 0 || !f->IsOpen()) {
46  //std::cerr << "MonitoringFile::fitMergedFile_IDPerfMonManager(): "
47  //<< "Input file not opened\n";
48  delete f;
49  return;
50  }
51  if (f->GetSize() < 1000.) {
52  //std::cerr << "MonitoringFile::fitMergedFile_IDPerfMonManager(): "
53  //<< "MonitoringFile empty\n";
54  delete f;
55  return;
56  }
57  std::string run_dir;
58  TIter next_run(f->GetListOfKeys());
59  TKey* key_run(0);
60  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
61  TObject* obj_run = key_run->ReadObj();
62  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
63  if (tdir_run != 0) {
64  std::string tdir_run_name(tdir_run->GetName());
65  if (tdir_run_name.find("run") != std::string::npos) {
66  run_dir = tdir_run_name;
67  // std::cout<<"Run_directory: "<<run_dir<<std::endl;
68  TIter next_perf(tdir_run->GetListOfKeys());
69  TKey* key_perf(0);
70  while ((key_perf = dynamic_cast<TKey*>(next_perf())) != 0) {
71  std::string perf_name(key_perf->GetName());
72  // for hist file with run_directory
73  if (perf_name.find("IDPerfMon") != std::string::npos) {
74  TObject* obj_perf = key_perf->ReadObj();
75  TDirectory* tdir_perf = dynamic_cast<TDirectory*>(obj_perf);
76  if (tdir_perf != 0) {
77  run_dir = run_dir + '/';
78  TIter next_module(tdir_perf->GetListOfKeys());
79  TKey* key_module(0);
80  while ((key_module = dynamic_cast<TKey*>(next_module())) != 0) {
81  std::string module_name(key_module->GetName());
82  if (module_name.find("Kshort") != std::string::npos) {
83  TObject* obj_Kshort = key_module->ReadObj();
84  TDirectory* tdir_Kshort = dynamic_cast<TDirectory*>(obj_Kshort);
85  if (tdir_Kshort != 0) {
86  TIter next_trigger(tdir_Kshort->GetListOfKeys());
87  TKey* key_trigger(0);
88  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
89  std::string TriggerName = key_trigger->GetName();
90  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
91  fitMergedFile_IDPerfMonKshort(f, run_dir, TriggerName);
92  }
93  } else {
94  delete obj_Kshort;
95  }
96  }
97 
98  if (module_name.find("Jpsi") != std::string::npos) {
99  TObject* obj_Jpsi = key_module->ReadObj();
100  TDirectory* tdir_Jpsi = dynamic_cast<TDirectory*>(obj_Jpsi);
101  if (tdir_Jpsi != 0) {
102  TIter next_trigger(tdir_Jpsi->GetListOfKeys());
103  TKey* key_trigger(0);
104  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
105  std::string TriggerName = key_trigger->GetName();
106  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
107  fitMergedFile_IDPerfMonJpsi(f, run_dir, TriggerName);
108  }
109  } else {
110  delete obj_Jpsi;
111  }
112  }
113  if (module_name.find("Upsilon") != std::string::npos) {
114  TObject* obj_Upsilon = key_module->ReadObj();
115  TDirectory* tdir_Upsilon = dynamic_cast<TDirectory*>(obj_Upsilon);
116  if (tdir_Upsilon != 0) {
117  TIter next_trigger(tdir_Upsilon->GetListOfKeys());
118  TKey* key_trigger(0);
119  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
120  std::string TriggerName = key_trigger->GetName();
121  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
122  fitMergedFile_IDPerfMonUpsilon(f, run_dir, TriggerName);
123  }
124  } else {
125  delete obj_Upsilon;
126  }
127  }
128  if (module_name.find("Zee") != std::string::npos) {
129  TObject* obj_Zee = key_module->ReadObj();
130  TDirectory* tdir_Zee = dynamic_cast<TDirectory*>(obj_Zee);
131  if (tdir_Zee != 0) {
132  TIter next_trigger(tdir_Zee->GetListOfKeys());
133  TKey* key_trigger(0);
134  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
135  std::string TriggerName = key_trigger->GetName();
136  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
137  fitMergedFile_IDPerfMonZee(f, run_dir, TriggerName);
138  }
139  } else {
140  delete obj_Zee;
141  }
142  }
143  if (module_name.find("Wenu") != std::string::npos) {
144  TObject* obj_Wenu = key_module->ReadObj();
145  TDirectory* tdir_Wenu = dynamic_cast<TDirectory*>(obj_Wenu);
146  if (tdir_Wenu != 0) {
147  TIter next_trigger(tdir_Wenu->GetListOfKeys());
148  TKey* key_trigger(0);
149  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
150  std::string TriggerName = key_trigger->GetName();
151  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
152  fitMergedFile_IDPerfMonWenu(f, run_dir, TriggerName);
153  }
154  } else {
155  delete obj_Wenu;
156  }
157  }
158  if (module_name.find("ZMM") != std::string::npos) {
159  TObject* obj_ZMM = key_module->ReadObj();
160  TDirectory* tdir_ZMM = dynamic_cast<TDirectory*>(obj_ZMM);
161  if (tdir_ZMM != 0) {
162  TIter next_trigger(tdir_ZMM->GetListOfKeys());
163  TKey* key_trigger(0);
164  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
165  std::string TriggerName = key_trigger->GetName();
166  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
167  fitMergedFile_IDPerfMonZMM(f, run_dir, TriggerName);
168  }
169  } else {
170  delete obj_ZMM;
171  }
172  }
173  }
174  } else {
175  delete obj_perf;
176  }
177  }
178  }
179  }
180  // if without top run_directory
181  else if (tdir_run_name.find("IDPerfMon") != std::string::npos) {
182  //std::cout<<"without run_directory"<<std::endl;
183  TObject* obj_perf = key_run->ReadObj();
184  TDirectory* tdir_perf = dynamic_cast<TDirectory*>(obj_perf);
185  if (tdir_perf != 0) {
186  run_dir = '/';
187  TIter next_module(tdir_perf->GetListOfKeys());
188  TKey* key_module(0);
189  while ((key_module = dynamic_cast<TKey*>(next_module())) != 0) {
190  std::string module_name(key_module->GetName());
191  if (module_name.find("Kshort") != std::string::npos) {
192  TObject* obj_Kshort = key_module->ReadObj();
193  TDirectory* tdir_Kshort = dynamic_cast<TDirectory*>(obj_Kshort);
194  if (tdir_Kshort != 0) {
195  TIter next_trigger(tdir_Kshort->GetListOfKeys());
196  TKey* key_trigger(0);
197  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
198  std::string TriggerName = key_trigger->GetName();
199  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
200  fitMergedFile_IDPerfMonKshort(f, run_dir, TriggerName);
201  }
202  } else {
203  delete obj_Kshort;
204  }
205  }
206  if (module_name.find("Jpsi") != std::string::npos) {
207  TObject* obj_Jpsi = key_module->ReadObj();
208  TDirectory* tdir_Jpsi = dynamic_cast<TDirectory*>(obj_Jpsi);
209  if (tdir_Jpsi != 0) {
210  TIter next_trigger(tdir_Jpsi->GetListOfKeys());
211  TKey* key_trigger(0);
212  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
213  std::string TriggerName = key_trigger->GetName();
214  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
215  fitMergedFile_IDPerfMonJpsi(f, run_dir, TriggerName);
216  }
217  } else {
218  delete obj_Jpsi;
219  }
220  }
221  if (module_name.find("Upsilon") != std::string::npos) {
222  TObject* obj_Upsilon = key_module->ReadObj();
223  TDirectory* tdir_Upsilon = dynamic_cast<TDirectory*>(obj_Upsilon);
224  if (tdir_Upsilon != 0) {
225  TIter next_trigger(tdir_Upsilon->GetListOfKeys());
226  TKey* key_trigger(0);
227  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
228  std::string TriggerName = key_trigger->GetName();
229  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
230  fitMergedFile_IDPerfMonUpsilon(f, run_dir, TriggerName);
231  }
232  } else {
233  delete obj_Upsilon;
234  }
235  }
236  if (module_name.find("Zee") != std::string::npos) {
237  TObject* obj_Zee = key_module->ReadObj();
238  TDirectory* tdir_Zee = dynamic_cast<TDirectory*>(obj_Zee);
239  if (tdir_Zee != 0) {
240  TIter next_trigger(tdir_Zee->GetListOfKeys());
241  TKey* key_trigger(0);
242  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
243  std::string TriggerName = key_trigger->GetName();
244  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
245  fitMergedFile_IDPerfMonZee(f, run_dir, TriggerName);
246  }
247  } else {
248  delete obj_Zee;
249  }
250  }
251  if (module_name.find("Wenu") != std::string::npos) {
252  TObject* obj_Wenu = key_module->ReadObj();
253  TDirectory* tdir_Wenu = dynamic_cast<TDirectory*>(obj_Wenu);
254  if (tdir_Wenu != 0) {
255  TIter next_trigger(tdir_Wenu->GetListOfKeys());
256  TKey* key_trigger(0);
257  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
258  std::string TriggerName = key_trigger->GetName();
259  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
260  fitMergedFile_IDPerfMonWenu(f, run_dir, TriggerName);
261  }
262  } else {
263  delete obj_Wenu;
264  }
265  }
266  if (module_name.find("ZMM") != std::string::npos) {
267  TObject* obj_ZMM = key_module->ReadObj();
268  TDirectory* tdir_ZMM = dynamic_cast<TDirectory*>(obj_ZMM);
269  if (tdir_ZMM != 0) {
270  TIter next_trigger(tdir_ZMM->GetListOfKeys());
271  TKey* key_trigger(0);
272  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
273  std::string TriggerName = key_trigger->GetName();
274  // std::cout<<"Find Module: "<<module_name<<" Trigger: "<<TriggerName<<std::endl;
275  fitMergedFile_IDPerfMonZMM(f, run_dir, TriggerName);
276  }
277  } else {
278  delete obj_ZMM;
279  }
280  }
281  }
282  } else {
283  delete obj_perf;
284  }
285  }
286  // else
287  //std::cerr<<"directory IDPerfMon doesn't exist !"<<std::endl;
288  } else {
289  delete obj_run;
290  }
291  }
292 
293  f->Close();
294  delete f;
295  // std::cout << "\n";
296  //std::cout << "Finish Inner-Detector performance-monitoring analysis"<<std::endl;
297  }

◆ fitMergedFile_IDPerfMonUpsilon()

void dqutils::MonitoringFile::fitMergedFile_IDPerfMonUpsilon ( TFile *  f,
const std::string &  run_dir,
const std::string &  TriggerName 
)
static

Definition at line 1190 of file MonitoringFile_IDPerfPostProcess.cxx.

1191  {
1192  std::string path;
1193  path = run_dir + "IDPerfMon/Upsilon/" + TriggerName;
1194 
1195  if (f->cd(path.c_str()) == 0) {
1196  //std::cerr<< "MonitoringFile::fitMergedFile_IDPerfMonUpsilon(): "
1197  //<<"No such directory \""<< path << "\"\n";
1198  return;
1199  }
1200 
1201  TH1F* h_upsilon_invmass_vs_pt = new TH1F("Upsilon_invmass_vs_pt",
1202  "Upsilon invmass-PDGmass vs. Upsilon Pt; p_{T}(#Upsilon) [GeV/c]; Mass Shift [GeV/c^{2}]", 6, 4.,
1203  20.);
1204  TH1F* h_upsilon_invmass_vs_z0 = new TH1F("Upsilon_invmass_vs_z0",
1205  "Upsilon invmass-PDGmass vs. muon z0; z0(#mu) [mm]; Mass Shift [GeV/c^{2}]", 6, -100.,
1206  100.);
1207  TH1F* h_upsilon_invmass_vs_phi = new TH1F("Upsilon_invmass_vs_phi",
1208  "Upsilon invmass-PDGmass vs. Upsilon phi; #phi(#Upsilon) [rad]; Mass Shift [GeV/c^{2}]", 6, -3.15,
1209  3.15);
1210  TH1F* h_upsilon_invmass_vs_phiplus = new TH1F("Upsilon_invmass_vs_phiplus",
1211  "Upsilon invmass-PDGmass vs. Muon+ phi; #phi(#mu^{+}) [rad]; Mass Shift [GeV/c^{2}]", 6, -3.15,
1212  3.15);
1213  TH1F* h_upsilon_invmass_vs_phiminus = new TH1F("Upsilon_invmass_vs_phiminus",
1214  "Upsilon invmass-PDGmass vs. Muon- phi; #phi(#mu^{-}) [rad]; Mass Shift [GeV/c^{2}]", 6, -3.15,
1215  3.15);
1216  TH1F* h_upsilon_invmass_vs_phidiff = new TH1F("Upsilon_invmass_vs_phidiff",
1217  "Upsilon invmass-PDGmass vs. |phi(+)-phi(-)|; |#phi(#mu^{+})-#phi(#mu^{-})| [rad]; Mass Shift [GeV/c^{2}]", 6, 0.,
1218  2.5);
1219  TH1F* h_upsilon_invmass_vs_eta = new TH1F("Upsilon_invmass_vs_eta",
1220  "Upsilon invmass-PDGmass vs. Upsilon eta; #eta(#Upsilon); Mass Shift [GeV/c^{2}]", 8, -3.2,
1221  3.2);
1222  TH1F* h_upsilon_invmass_vs_eta_barrel = new TH1F("Upsilon_invmass_vs_eta_barrel",
1223  "Upsilon invmass-PDGmass vs. Upsilon eta (barrel); #eta(#Upsilon); Mass Shift [GeV/c^{2}]", 2, -0.8,
1224  0.8);
1225  TH1F* h_upsilon_invmass_vs_eta_eca = new TH1F("Upsilon_invmass_vs_eta_eca",
1226  "Upsilon invmass-PDGmass vs. Upsilon eta (endcap A); #eta(#Upsilon); Mass Shift [GeV/c^{2}]", 3, 0.8,
1227  3.2);
1228  TH1F* h_upsilon_invmass_vs_eta_ecc = new TH1F("Upsilon_invmass_vs_eta_ecc",
1229  "Upsilon invmass-PDGmass vs. Upsilon eta (endcap C); #eta(#Upsilon); Mass Shift [GeV/c^{2}]", 3, -3.2,
1230  -0.8);
1231  TH1F* h_upsilon_invmass_vs_etaplus = new TH1F("Upsilon_invmass_vs_etaplus",
1232  "Upsilon invmass-PDGmass vs. Muon+ eta; #eta(#mu^{+}); Mass Shift [GeV/c^{2}]", 6, -2.4,
1233  2.4);
1234  TH1F* h_upsilon_invmass_vs_etaminus = new TH1F("Upsilon_invmass_vs_etaminus",
1235  "Upsilon invmass-PDGmass vs. Muon- eta; #eta(#mu^{-}); Mass Shift [GeV/c^{2}]", 6, -2.4,
1236  2.4);
1237  TH1F* h_upsilon_invmass_vs_maxeta = new TH1F("Upsilon_invmass_vs_maxeta",
1238  "Upsilon invmass-PDGmass vs. max Muon |eta|; max|#eta(#mu)|; Mass Shift [GeV/c^{2}]", 6, -2.4,
1239  2.4);
1240  TH1F* h_upsilon_invmass_vs_etadiff = new TH1F("Upsilon_invmass_vs_etadiff",
1241  "Upsilon invmass-PDGmass vs. eta(+)-eta(-); #eta(#mu^{+})-#eta(#mu^{-}); Mass Shift [GeV/c^{2}]", 6, -1.5,
1242  1.5);
1243  TH1F* h_upsilon_invmass_vs_crt = new TH1F("Upsilon_invmass_vs_curvature",
1244  "Upsilon invmass-PDGmass vs. crt(+)-|crt(-)|; 1/p_{T}(#mu^{+})-1/p_{T}(#mu^{-}) [GeV^{-1}]; Mass Shift [GeV/c^{2}]", 6, -0.15,
1245  0.15);
1246  TH1F* h_upsilon_invmass_vs_invpt = new TH1F("Upsilon_invmass_vs_invpt",
1247  "Upsilon invmass-PDGmass vs. muon 1/Pt; 1/p_{T}(#mu) [(GeV/c)^{-1}]; Mass Shift [GeV/c^{2}]", 6, 0.05,
1248  0.25);
1249  TH1F* h_upsilon_invmass_vs_angle_eta = new TH1F("Upsilon_invmass_vs_angle_eta",
1250  "Upsilon invmass-PDGmass vs. arccos(#Delta#eta/#DeltaR);arccos(#Delta#eta/#DeltaR); Mass Shift [GeV/c^{2}]", 6, 0.,
1251  90.);
1252 
1253  TH1F* h_upsilon_width_vs_pt = new TH1F("Upsilon_width_vs_pt",
1254  "Upsilon width vs. Upsilon Pt; p_{T}(#Upsilon) [GeV/c]; Width [GeV/c^{2}]",
1255  6, 4., 20.);
1256  TH1F* h_upsilon_width_vs_z0 = new TH1F("Upsilon_width_vs_z0",
1257  "Upsilon width vs. muon z0; z0(#mu) [mm]; Width [GeV/c^{2}]", 6, -100.,
1258  100.);
1259  TH1F* h_upsilon_width_vs_phi = new TH1F("Upsilon_width_vs_phi",
1260  "Upsilon width vs. Upsilon phi; #phi(#Upsilon) [rad]; Width [GeV/c^{2}]", 6,
1261  -3.15, 3.15);
1262  TH1F* h_upsilon_width_vs_phiplus = new TH1F("Upsilon_width_vs_phiplus",
1263  "Upsilon width vs. Muon+ phi; #phi(#mu^{+}) [rad]; Width [GeV/c^{2}]",
1264  6, -3.15, 3.15);
1265  TH1F* h_upsilon_width_vs_phiminus = new TH1F("Upsilon_width_vs_phiminus",
1266  "Upsilon width vs. Muon- phi; #phi(#mu^{-}) [rad]; Width [GeV/c^{2}]",
1267  6, -3.15, 3.15);
1268  TH1F* h_upsilon_width_vs_phidiff = new TH1F("Upsilon_width_vs_phidiff",
1269  "Upsilon width vs. |phi(+)-phi(-)|; |#phi(#mu^{+})-#phi(#mu^{-})| [rad]; Width [GeV/c^{2}]", 6, 0.,
1270  2.5);
1271  TH1F* h_upsilon_width_vs_eta = new TH1F("Upsilon_width_vs_eta",
1272  "Upsilon width vs. Upsilon eta; #eta(#Upsilon); Width [GeV/c^{2}]", 8, -3.2,
1273  3.2);
1274  TH1F* h_upsilon_width_vs_eta_barrel = new TH1F("Upsilon_width_vs_eta_barrel",
1275  "Upsilon width vs. Upsilon eta (barrel); #eta(#Upsilon); Width [GeV/c^{2}]", 2, -0.8,
1276  0.8);
1277  TH1F* h_upsilon_width_vs_eta_eca = new TH1F("Upsilon_width_vs_eta_eca",
1278  "Upsilon width vs. Upsilon eta (endcap A); #eta(#Upsilon); Width [GeV/c^{2}]", 3, 0.8,
1279  3.2);
1280  TH1F* h_upsilon_width_vs_eta_ecc = new TH1F("Upsilon_width_vs_eta_ecc",
1281  "Upsilon width vs. Upsilon eta (endcap C); #eta(#Upsilon); Width [GeV/c^{2}]", 3, -3.2,
1282  -0.8);
1283  TH1F* h_upsilon_width_vs_etaplus = new TH1F("Upsilon_width_vs_etaplus",
1284  "Upsilon width vs. Muon+ eta; #eta(#mu^{+}); Width [GeV/c^{2}]", 6,
1285  -2.4, 2.4);
1286  TH1F* h_upsilon_width_vs_etaminus = new TH1F("Upsilon_width_vs_etaminus",
1287  "Upsilon width vs. Muon- eta; #eta(#mu^{-}); Width [GeV/c^{2}]", 6,
1288  -2.4, 2.4);
1289  TH1F* h_upsilon_width_vs_maxeta = new TH1F("Upsilon_width_vs_maxeta",
1290  "Upsilon width vs. max Muon |eta|; max|#eta(#mu)|; Width [GeV/c^{2}]", 6,
1291  -2.4, 2.4);
1292  TH1F* h_upsilon_width_vs_etadiff = new TH1F("Upsilon_width_vs_etadiff",
1293  "Upsilon width vs. eta(+)-eta(-); #eta(#mu^{+})-#eta(#mu^{-}); Width [GeV/c^{2}]", 6, -1.5,
1294  1.5);
1295  TH1F* h_upsilon_width_vs_crt = new TH1F("Upsilon_width_vs_curvature",
1296  "Upsilon width vs. crt(+)-|crt(-)|; 1/p_{T}(#mu^{+})-1/p_{T}(#mu^{-}) [GeV^{-1}]; Width [GeV/c^{2}]", 6, -0.15,
1297  0.15);
1298  TH1F* h_upsilon_width_vs_invpt = new TH1F("Upsilon_width_vs_invpt",
1299  "Upsilon width vs. muon 1/Pt; 1/p_{T}(#mu) [(GeV/c)^{-1}]; Width [GeV/c^{2}]", 6, 0.05,
1300  0.25);
1301  TH1F* h_upsilon_width_vs_angle_eta = new TH1F("Upsilon_width_vs_angle_eta",
1302  "Upsilon width vs. arccos(#Delta#eta/#DeltaR);arccos(#Delta#eta/#DeltaR); width [GeV/c^{2}]", 6, 0.,
1303  90.);
1304 
1305  const int nbins = 6;
1306  TH1F* hpt[nbins];
1307  TH1F* hz0[nbins];
1308  TH1F* hphi[nbins];
1309  TH1F* hphiplus[nbins];
1310  TH1F* hphiminus[nbins];
1311  TH1F* hphidiff[nbins];
1312  TH1F* heta[8];
1313  TH1F* heta_b[2];
1314  TH1F* heta_ecc[3];
1315  TH1F* heta_eca[3];
1316  TH1F* hetadiff[nbins];
1317  TH1F* hmaxeta[nbins];
1318  TH1F* hinvpt[nbins];
1319  TH1F* hcrt[nbins];
1320  TH1F* hetaplus[nbins];
1321  TH1F* hetaminus[nbins];
1322  TH1F* hangle_eta[nbins];
1323 
1324  if (!CheckHistogram(f, (path + "/Upsilon_invmass").c_str())) return;
1325 
1326  TH1F* h_mass = (TH1F*) (f->Get((path + "/Upsilon_invmass").c_str())->Clone());
1327  if (CheckHistogram(f, (path + "/Nevents").c_str())) {
1328  TH1F* h_Nevents = (TH1F*) f->Get((path + "/Nevents").c_str());
1329  TH1F* h_rate = new TH1F("rate", "production rate", 1, 0, 1);
1330  double Ntot = h_Nevents->GetEntries();
1331  double yield = h_mass->Integral(h_mass->FindBin(9.1), h_mass->FindBin(9.8));
1332  double rate = yield / Ntot;
1333  double rate_error = sqrt(1 / yield + 1 / Ntot) * yield / Ntot;
1334  h_rate->SetBinContent(1, rate);
1335  h_rate->SetBinError(1, rate_error);
1336  h_rate->Write("", TObject::kOverwrite);
1337  }
1338 // TH1F* h_mass_scaled = (TH1F*)(f->Get((path+"/Upsilon_invmass").c_str())->Clone("Upsilon_invmass_scaled_copy"));
1339 // h_mass_scaled->SetMarkerStyle(21);
1340 // TString title(h_mass_scaled->GetTitle());
1341 // if (CheckHistogram(f,(path+"/Upsilon_invmass_scaled").c_str())) {
1342 // if (CheckHistogram(f,(path+"/Nevents").c_str())) {
1343 // TH1F* h_Nevents=(TH1F*)f->Get((path+"/Nevents").c_str());
1344 // double Ntot =h_Nevents->GetEntries();
1345 // if (Ntot!=0.) h_mass_scaled->Scale(1./Ntot);
1346 // h_mass_scaled->SetTitle(title+" (per event)");
1347 // h_mass_scaled->Write("Upsilon_invmass_scaled",TObject::kOverwrite);
1348 // }
1349 // }
1350 // delete h_mass_scaled;
1351  if (CheckHistogram(f, (path + "/Upsilon_invmass").c_str())) {
1352  TH1F* h_mass_rebin = (TH1F*) (f->Get((path + "/Upsilon_invmass").c_str())->Clone("Upsilon_invmass_rebin"));
1353  TString title = h_mass_rebin->GetTitle();
1354  h_mass_rebin->SetMarkerStyle(21);
1355  h_mass_rebin->Rebin(8);
1356  h_mass_rebin->SetTitle(title + " (larger binning for low Stats.)");
1357  h_mass_rebin->Write("Upsilon_invmass_rebin", TObject::kOverwrite);
1358  }
1359 
1360  char cpt[100], cz0[100], cphi[100], cphidiff[100], ceta[100], cetadiff[100], cmaxeta[100], ccrt[100], cinvpt[100],
1361  cphiplus[100], cphiminus[100], cetaplus[100], cetaminus[100], ceta_b[100], ceta_ecc[100], ceta_eca[100],
1362  cangle_eta[100];
1363 
1364  for (int i = 0; i < nbins; i++) {
1365  sprintf(cpt, (path + "/pt_bin%d").c_str(), i);
1366  sprintf(cz0, (path + "/z0_bin%d").c_str(), i);
1367  sprintf(cphi, (path + "/phi_bin%d").c_str(), i);
1368  sprintf(cphiplus, (path + "/phiplus_bin%d").c_str(), i);
1369  sprintf(cphiminus, (path + "/phiminus_bin%d").c_str(), i);
1370  sprintf(cphidiff, (path + "/phidiff_bin%d").c_str(), i);
1371  sprintf(cetaplus, (path + "/etaplus_bin%d").c_str(), i);
1372  sprintf(cetaminus, (path + "/etaminus_bin%d").c_str(), i);
1373  sprintf(cmaxeta, (path + "/maxeta_bin%d").c_str(), i);
1374  sprintf(cetadiff, (path + "/etadiff_bin%d").c_str(), i);
1375  sprintf(ccrt, (path + "/crt_bin%d").c_str(), i);
1376  sprintf(cinvpt, (path + "/invpt_bin%d").c_str(), i);
1377  sprintf(cangle_eta, (path + "/angle_eta_bin%d").c_str(), i);
1378 
1379  if (!CheckHistogram(f, cpt)) return;
1380 
1381  if (!CheckHistogram(f, cz0)) return;
1382 
1383  if (!CheckHistogram(f, cphi)) return;
1384 
1385  if (!CheckHistogram(f, cphiplus)) return;
1386 
1387  if (!CheckHistogram(f, cphiminus)) return;
1388 
1389  if (!CheckHistogram(f, cphidiff)) return;
1390 
1391  if (!CheckHistogram(f, cetaplus)) return;
1392 
1393  if (!CheckHistogram(f, cetaminus)) return;
1394 
1395  if (!CheckHistogram(f, cmaxeta)) return;
1396 
1397  if (!CheckHistogram(f, cetadiff)) return;
1398 
1399  if (!CheckHistogram(f, ccrt)) return;
1400 
1401  if (!CheckHistogram(f, cinvpt)) return;
1402 
1403  if (!CheckHistogram(f, cangle_eta)) return;
1404 
1405  hpt[i] = (TH1F*) (f->Get(cpt)->Clone());
1406  hz0[i] = (TH1F*) (f->Get(cz0)->Clone());
1407  hphi[i] = (TH1F*) (f->Get(cphi)->Clone());
1408  hphiplus[i] = (TH1F*) (f->Get(cphiplus)->Clone());
1409  hphiminus[i] = (TH1F*) (f->Get(cphiminus)->Clone());
1410  hphidiff[i] = (TH1F*) (f->Get(cphidiff)->Clone());
1411  hetaplus[i] = (TH1F*) (f->Get(cetaplus)->Clone());
1412  hetaminus[i] = (TH1F*) (f->Get(cetaminus)->Clone());
1413  hetadiff[i] = (TH1F*) (f->Get(cetadiff)->Clone());
1414  hmaxeta[i] = (TH1F*) (f->Get(cmaxeta)->Clone());
1415  hcrt[i] = (TH1F*) (f->Get(ccrt)->Clone());
1416  hinvpt[i] = (TH1F*) (f->Get(cinvpt)->Clone());
1417  hangle_eta[i] = (TH1F*) (f->Get(cangle_eta)->Clone());
1418 
1419  if (i < 2) {
1420  sprintf(ceta_b, (path + "/eta_b_bin%d").c_str(), i);
1421  if (!CheckHistogram(f, ceta_b)) return;
1422 
1423  heta_b[i] = (TH1F*) (f->Get(ceta_b)->Clone());
1424  }
1425  if (i < 3) {
1426  sprintf(ceta_ecc, (path + "/eta_ecc_bin%d").c_str(), i);
1427  sprintf(ceta_eca, (path + "/eta_eca_bin%d").c_str(), i);
1428  if (!CheckHistogram(f, ceta_ecc)) return;
1429 
1430  if (!CheckHistogram(f, ceta_eca)) return;
1431 
1432  heta_ecc[i] = (TH1F*) (f->Get(ceta_ecc)->Clone());
1433  heta_eca[i] = (TH1F*) (f->Get(ceta_eca)->Clone());
1434  }
1435  }
1436  for (int i = 0; i < 8; i++) {
1437  sprintf(ceta, (path + "/eta_bin%d").c_str(), i);
1438  if (!CheckHistogram(f, ceta)) return;
1439 
1440  heta[i] = (TH1F*) (f->Get(ceta)->Clone());
1441  }
1442 
1443 // TF1 *f1 = new TF1("f1","gaus",9.,10.);
1444 // f1->SetParameter(1,9.046);
1445 // f1->SetParameter(2,0.15);
1446 // f1->SetLineColor(2);
1447 // f1->SetParNames("Constant","Mean","Width");
1448  h_mass->SetMarkerStyle(21);
1449 
1450  TCanvas* myCanvas = new TCanvas("MyCanvas");
1451  myCanvas->cd();
1452 
1453 // h_mass->Fit(f1,"RQMN");
1454 
1455 
1456  fitUpsilonHistograms(h_upsilon_invmass_vs_pt, h_upsilon_width_vs_pt, hpt, nbins);
1457  fitUpsilonHistograms(h_upsilon_invmass_vs_z0, h_upsilon_width_vs_z0, hz0, nbins);
1458  fitUpsilonHistograms(h_upsilon_invmass_vs_phi, h_upsilon_width_vs_phi, hphi, nbins);
1459  fitUpsilonHistograms(h_upsilon_invmass_vs_phiplus, h_upsilon_width_vs_phiplus, hphiplus, nbins);
1460  fitUpsilonHistograms(h_upsilon_invmass_vs_phiminus, h_upsilon_width_vs_phiminus, hphiminus, nbins);
1461  fitUpsilonHistograms(h_upsilon_invmass_vs_phidiff, h_upsilon_width_vs_phidiff, hphidiff, nbins);
1462  fitUpsilonHistograms(h_upsilon_invmass_vs_eta, h_upsilon_width_vs_eta, heta, 8);
1463  fitUpsilonHistograms(h_upsilon_invmass_vs_eta_barrel, h_upsilon_width_vs_eta_barrel, heta_b, 2);
1464  fitUpsilonHistograms(h_upsilon_invmass_vs_eta_eca, h_upsilon_width_vs_eta_eca, heta_eca, 3);
1465  fitUpsilonHistograms(h_upsilon_invmass_vs_eta_ecc, h_upsilon_width_vs_eta_ecc, heta_ecc, 3);
1466  fitUpsilonHistograms(h_upsilon_invmass_vs_etaplus, h_upsilon_width_vs_etaplus, hetaplus, nbins);
1467  fitUpsilonHistograms(h_upsilon_invmass_vs_etaminus, h_upsilon_width_vs_etaminus, hetaminus, nbins);
1468  fitUpsilonHistograms(h_upsilon_invmass_vs_maxeta, h_upsilon_width_vs_maxeta, hmaxeta, nbins);
1469  fitUpsilonHistograms(h_upsilon_invmass_vs_etadiff, h_upsilon_width_vs_etadiff, hetadiff, nbins);
1470  fitUpsilonHistograms(h_upsilon_invmass_vs_crt, h_upsilon_width_vs_crt, hcrt, nbins);
1471  fitUpsilonHistograms(h_upsilon_invmass_vs_invpt, h_upsilon_width_vs_invpt, hinvpt, nbins);
1472  fitUpsilonHistograms(h_upsilon_invmass_vs_angle_eta, h_upsilon_width_vs_angle_eta, hangle_eta, nbins);
1473 
1474 
1475  // f->cd(path.c_str());
1476  if (f->cd(path.c_str()) == 0) {
1477  //std::cerr<< "MonitoringFile::fitMergedFile_IDPerfMonUpsilon(): "
1478  //<<"No such directory \""<< path << "\"\n";
1479  return;
1480  }
1481 
1482  h_mass->Write("", TObject::kOverwrite);
1483  for (int i = 0; i < nbins; i++) {
1484  hpt[i]->Write("", TObject::kOverwrite);
1485  hz0[i]->Write("", TObject::kOverwrite);
1486  hphi[i]->Write("", TObject::kOverwrite);
1487  hphiplus[i]->Write("", TObject::kOverwrite);
1488  hphiminus[i]->Write("", TObject::kOverwrite);
1489  hphidiff[i]->Write("", TObject::kOverwrite);
1490  hetadiff[i]->Write("", TObject::kOverwrite);
1491  hmaxeta[i]->Write("", TObject::kOverwrite);
1492  hinvpt[i]->Write("", TObject::kOverwrite);
1493  hcrt[i]->Write("", TObject::kOverwrite);
1494  hetaplus[i]->Write("", TObject::kOverwrite);
1495  hetaminus[i]->Write("", TObject::kOverwrite);
1496  hangle_eta[i]->Write("", TObject::kOverwrite);
1497  if (i < 2) {
1498  heta_b[i]->Write("", TObject::kOverwrite);
1499  }
1500  if (i < 3) {
1501  heta_ecc[i]->Write("", TObject::kOverwrite);
1502  heta_eca[i]->Write("", TObject::kOverwrite);
1503  }
1504  }
1505  for (int i = 0; i < 8; i++) {
1506  heta[i]->Write("", TObject::kOverwrite);
1507  }
1508  h_upsilon_invmass_vs_pt->Write("", TObject::kOverwrite);
1509  h_upsilon_invmass_vs_z0->Write("", TObject::kOverwrite);
1510  h_upsilon_invmass_vs_phi->Write("", TObject::kOverwrite);
1511  h_upsilon_invmass_vs_phiplus->Write("", TObject::kOverwrite);
1512  h_upsilon_invmass_vs_phiminus->Write("", TObject::kOverwrite);
1513  h_upsilon_invmass_vs_phidiff->Write("", TObject::kOverwrite);
1514  h_upsilon_invmass_vs_eta->Write("", TObject::kOverwrite);
1515  h_upsilon_invmass_vs_eta_barrel->Write("", TObject::kOverwrite);
1516  h_upsilon_invmass_vs_eta_ecc->Write("", TObject::kOverwrite);
1517  h_upsilon_invmass_vs_eta_eca->Write("", TObject::kOverwrite);
1518  h_upsilon_invmass_vs_etadiff->Write("", TObject::kOverwrite);
1519  h_upsilon_invmass_vs_etaplus->Write("", TObject::kOverwrite);
1520  h_upsilon_invmass_vs_etaminus->Write("", TObject::kOverwrite);
1521  h_upsilon_invmass_vs_maxeta->Write("", TObject::kOverwrite);
1522  h_upsilon_invmass_vs_crt->Write("", TObject::kOverwrite);
1523  h_upsilon_invmass_vs_invpt->Write("", TObject::kOverwrite);
1524  h_upsilon_invmass_vs_angle_eta->Write("", TObject::kOverwrite);
1525 
1526  h_upsilon_width_vs_pt->Write("", TObject::kOverwrite);
1527  h_upsilon_width_vs_z0->Write("", TObject::kOverwrite);
1528  h_upsilon_width_vs_phi->Write("", TObject::kOverwrite);
1529  h_upsilon_width_vs_phiplus->Write("", TObject::kOverwrite);
1530  h_upsilon_width_vs_phiminus->Write("", TObject::kOverwrite);
1531  h_upsilon_width_vs_phidiff->Write("", TObject::kOverwrite);
1532  h_upsilon_width_vs_eta->Write("", TObject::kOverwrite);
1533  h_upsilon_width_vs_eta_barrel->Write("", TObject::kOverwrite);
1534  h_upsilon_width_vs_eta_ecc->Write("", TObject::kOverwrite);
1535  h_upsilon_width_vs_eta_eca->Write("", TObject::kOverwrite);
1536  h_upsilon_width_vs_etadiff->Write("", TObject::kOverwrite);
1537  h_upsilon_width_vs_etaplus->Write("", TObject::kOverwrite);
1538  h_upsilon_width_vs_etaminus->Write("", TObject::kOverwrite);
1539  h_upsilon_width_vs_maxeta->Write("", TObject::kOverwrite);
1540  h_upsilon_width_vs_crt->Write("", TObject::kOverwrite);
1541  h_upsilon_width_vs_invpt->Write("", TObject::kOverwrite);
1542  h_upsilon_width_vs_angle_eta->Write("", TObject::kOverwrite);
1543 
1544  myCanvas->Close();
1545  delete myCanvas;
1546 
1547  f->Write();
1548 
1549 // delete f1;
1550  }

◆ fitMergedFile_IDPerfMonWenu()

void dqutils::MonitoringFile::fitMergedFile_IDPerfMonWenu ( TFile *  f,
const std::string &  run_dir,
const std::string &  TriggerName 
)
static

Definition at line 1753 of file MonitoringFile_IDPerfPostProcess.cxx.

1754  {
1755  std::string path;
1756  path = run_dir + "IDPerfMon/Wenu/" + TriggerName;
1757  if (f->cd(path.c_str()) == 0) {
1758  //std::cerr << "MonitoringFile::fitMergedFile_IDPerfMonWenu(): "
1759  //<< "No such directory \"" << path << "\"\n";
1760  return;
1761  }
1762 
1763  f->cd(path.c_str());
1764 
1765  if (!CheckHistogram(f, (path + "/Wenu_trk_transmass_sel").c_str())) return;
1766 
1767  TH1F* h_mass = (TH1F*) (f->Get((path + "/Wenu_trk_transmass_sel").c_str())->Clone());
1768  if (CheckHistogram(f, (path + "/Nevents").c_str())) {
1769  TH1F* h_Nevents = (TH1F*) f->Get((path + "/Nevents").c_str());
1770  TH1F* h_rate = new TH1F("rate", "production rate", 1, 0, 1);
1771  double Ntot = h_Nevents->GetEntries();
1772  double yield = h_mass->Integral(h_mass->FindBin(50), h_mass->FindBin(80));
1773  double rate = yield / Ntot;
1774  double rate_error = sqrt(1 / yield + 1 / Ntot) * yield / Ntot;
1775  h_rate->SetBinContent(1, rate);
1776  h_rate->SetBinError(1, rate_error);
1777  h_rate->Write("", TObject::kOverwrite);
1778  }
1779 // TH1F* h_mass_scaled =
1780 // (TH1F*)(f->Get((path+"/Wenu_trk_transmass_sel").c_str())->Clone("Wenu_trk_transmass_sel_scaled_copy"));
1781 // TString title(h_mass_scaled->GetTitle());
1782 // if (CheckHistogram(f,(path+"/Wenu_trk_transmass_sel_scaled").c_str())) {
1783 // if (CheckHistogram(f,(path+"/Nevents").c_str())) {
1784 // TH1F* h_Nevents=(TH1F*)f->Get((path+"/Nevents").c_str());
1785 // double Ntot =h_Nevents->GetEntries();
1786 // if (Ntot!=0.) h_mass_scaled->Scale(1./Ntot);
1787 // h_mass_scaled->SetTitle(title+" (per event)");
1788 // h_mass_scaled->Write("Wenu_trk_transmass_sel_scaled",TObject::kOverwrite);
1789 // }
1790 // }
1791 // delete h_mass_scaled;
1792 
1793  enum eta_region {
1794  incl, barrel, eca, ecc, Nregions
1795  };
1796  std::vector<std::string> region_strings;
1797  region_strings.push_back("incl");
1798  region_strings.push_back("barrel");
1799  region_strings.push_back("eca");
1800  region_strings.push_back("ecc");
1801 
1802  std::vector<TH1F*> h_Wenu_Eopdiff;
1803  std::vector<TH1F*> h_Wenu_Eop_plus;
1804  std::vector<TH1F*> h_Wenu_Eop_minus;
1805 
1806  std::vector<TProfile*> h_Wenu_Eopdiff_vs_p;
1807  std::vector<TProfile*> h_Wenu_meanEop_vs_p_plus;
1808  std::vector<TProfile*> h_Wenu_meanEop_vs_p_minus;
1809 
1810  std::vector<TProfile*> h_Wenu_Eopdiff_vs_invp;
1811  std::vector<TProfile*> h_Wenu_meanEop_vs_invp_plus;
1812  std::vector<TProfile*> h_Wenu_meanEop_vs_invp_minus;
1813 
1814  std::vector<TProfile*> h_Wenu_Eopdiff_vs_E;
1815  std::vector<TProfile*> h_Wenu_meanEop_vs_E_plus;
1816  std::vector<TProfile*> h_Wenu_meanEop_vs_E_minus;
1817 
1818  std::vector<TProfile*> h_Wenu_Eopdiff_vs_phi;
1819  std::vector<TProfile*> h_Wenu_meanEop_vs_phi_plus;
1820  std::vector<TProfile*> h_Wenu_meanEop_vs_phi_minus;
1821 
1822  std::vector<TProfile*> h_Wenu_Eopdiff_vs_eta;
1823  std::vector<TProfile*> h_Wenu_meanEop_vs_eta_plus;
1824  std::vector<TProfile*> h_Wenu_meanEop_vs_eta_minus;
1825 
1826  std::string str;
1827 
1828  for (int region = 0; region != Nregions; ++region) {
1829  str = path + "/Wenu_Eop_plus_" + region_strings[region];
1830  if (!CheckHistogram(f, str.c_str())) return;
1831 
1832  h_Wenu_Eop_plus.push_back((TH1F*) (f->Get(str.c_str())));
1833  h_Wenu_Eop_plus[region]->SetTitle(h_Wenu_Eop_plus[region]->GetTitle());
1834  str = path + "/Wenu_Eop_minus_" + region_strings[region];
1835  if (!CheckHistogram(f, str.c_str())) return;
1836 
1837  h_Wenu_Eop_minus.push_back((TH1F*) (f->Get(str.c_str())));
1838  h_Wenu_Eop_minus[region]->SetTitle(h_Wenu_Eop_minus[region]->GetTitle());
1839  str = path + "/Wenu_Eopdiff_" + region_strings[region];
1840  if (!CheckHistogram(f, str.c_str())) return;
1841 
1842  h_Wenu_Eopdiff.push_back((TH1F*) (f->Get(str.c_str())));
1843  h_Wenu_Eopdiff[region]->SetTitle(h_Wenu_Eopdiff[region]->GetTitle());
1844 
1845  h_Wenu_Eopdiff[region]->Add(h_Wenu_Eop_plus[region], h_Wenu_Eop_minus[region], 1., -1);
1846 
1847  if (region == incl) {
1848  str = path + "/Wenu_meanEop_vs_p_plus";
1849  if (!CheckHistogram(f, str.c_str())) return;
1850 
1851  h_Wenu_meanEop_vs_p_plus.push_back((TProfile*) (f->Get(str.c_str())));
1852  h_Wenu_meanEop_vs_p_plus[region]->SetTitle(h_Wenu_meanEop_vs_p_plus[region]->GetTitle());
1853  str = path + "/Wenu_meanEop_vs_p_minus";
1854  if (!CheckHistogram(f, str.c_str())) return;
1855 
1856  h_Wenu_meanEop_vs_p_minus.push_back((TProfile*) (f->Get(str.c_str())));
1857  h_Wenu_meanEop_vs_p_minus[region]->SetTitle(h_Wenu_meanEop_vs_p_minus[region]->GetTitle());
1858  str = path + "/Wenu_Eopdiff_vs_p";
1859  if (!CheckHistogram(f, str.c_str())) return;
1860 
1861  h_Wenu_Eopdiff_vs_p.push_back((TProfile*) (f->Get(str.c_str())));
1862  h_Wenu_Eopdiff_vs_p[region]->SetTitle(h_Wenu_Eopdiff_vs_p[region]->GetTitle());
1863 
1864  str = path + "/Wenu_meanEop_vs_invp_plus";
1865  if (!CheckHistogram(f, str.c_str())) return;
1866 
1867  h_Wenu_meanEop_vs_invp_plus.push_back((TProfile*) (f->Get(str.c_str())));
1868  h_Wenu_meanEop_vs_invp_plus[region]->SetTitle(h_Wenu_meanEop_vs_invp_plus[region]->GetTitle());
1869  str = path + "/Wenu_meanEop_vs_invp_minus";
1870  if (!CheckHistogram(f, str.c_str())) return;
1871 
1872  h_Wenu_meanEop_vs_invp_minus.push_back((TProfile*) (f->Get(str.c_str())));
1873  h_Wenu_meanEop_vs_invp_minus[region]->SetTitle(h_Wenu_meanEop_vs_invp_minus[region]->GetTitle());
1874  str = path + "/Wenu_Eopdiff_vs_invp";
1875  if (!CheckHistogram(f, str.c_str())) return;
1876 
1877  h_Wenu_Eopdiff_vs_invp.push_back((TProfile*) (f->Get(str.c_str())));
1878  h_Wenu_Eopdiff_vs_invp[region]->SetTitle(h_Wenu_Eopdiff_vs_invp[region]->GetTitle());
1879 
1880  str = path + "/Wenu_meanEop_vs_E_plus";
1881  if (!CheckHistogram(f, str.c_str())) return;
1882 
1883  h_Wenu_meanEop_vs_E_plus.push_back((TProfile*) (f->Get(str.c_str())));
1884  h_Wenu_meanEop_vs_E_plus[region]->SetTitle(h_Wenu_meanEop_vs_E_plus[region]->GetTitle());
1885  str = path + "/Wenu_meanEop_vs_E_minus";
1886  if (!CheckHistogram(f, str.c_str())) return;
1887 
1888  h_Wenu_meanEop_vs_E_minus.push_back((TProfile*) (f->Get(str.c_str())));
1889  h_Wenu_meanEop_vs_E_minus[region]->SetTitle(h_Wenu_meanEop_vs_E_minus[region]->GetTitle());
1890  str = path + "/Wenu_Eopdiff_vs_E";
1891  if (!CheckHistogram(f, str.c_str())) return;
1892 
1893  h_Wenu_Eopdiff_vs_E.push_back((TProfile*) (f->Get(str.c_str())));
1894  h_Wenu_Eopdiff_vs_E[region]->SetTitle(h_Wenu_Eopdiff_vs_E[region]->GetTitle());
1895 
1896  str = path + "/Wenu_meanEop_vs_phi_plus";
1897  if (!CheckHistogram(f, str.c_str())) return;
1898 
1899  h_Wenu_meanEop_vs_phi_plus.push_back((TProfile*) (f->Get(str.c_str())));
1900  h_Wenu_meanEop_vs_phi_plus[region]->SetTitle(h_Wenu_meanEop_vs_phi_plus[region]->GetTitle());
1901  str = path + "/Wenu_meanEop_vs_phi_minus";
1902  if (!CheckHistogram(f, str.c_str())) return;
1903 
1904  h_Wenu_meanEop_vs_phi_minus.push_back((TProfile*) (f->Get(str.c_str())));
1905  h_Wenu_meanEop_vs_phi_minus[region]->SetTitle(h_Wenu_meanEop_vs_phi_minus[region]->GetTitle());
1906  str = path + "/Wenu_Eopdiff_vs_phi";
1907  if (!CheckHistogram(f, str.c_str())) return;
1908 
1909  h_Wenu_Eopdiff_vs_phi.push_back((TProfile*) (f->Get(str.c_str())));
1910  h_Wenu_Eopdiff_vs_phi[region]->SetTitle(h_Wenu_Eopdiff_vs_phi[region]->GetTitle());
1911 
1912  str = path + "/Wenu_meanEop_vs_eta_plus";
1913  if (!CheckHistogram(f, str.c_str())) return;
1914 
1915  h_Wenu_meanEop_vs_eta_plus.push_back((TProfile*) (f->Get(str.c_str())));
1916  h_Wenu_meanEop_vs_eta_plus[region]->SetTitle(h_Wenu_meanEop_vs_eta_plus[region]->GetTitle());
1917  str = path + "/Wenu_meanEop_vs_eta_minus";
1918  if (!CheckHistogram(f, str.c_str())) return;
1919 
1920  h_Wenu_meanEop_vs_eta_minus.push_back((TProfile*) (f->Get(str.c_str())));
1921  h_Wenu_meanEop_vs_eta_minus[region]->SetTitle(h_Wenu_meanEop_vs_eta_minus[region]->GetTitle());
1922  str = path + "/Wenu_Eopdiff_vs_eta";
1923  if (!CheckHistogram(f, str.c_str())) return;
1924 
1925  h_Wenu_Eopdiff_vs_eta.push_back((TProfile*) (f->Get(str.c_str())));
1926  h_Wenu_Eopdiff_vs_eta[region]->SetTitle(h_Wenu_Eopdiff_vs_eta[region]->GetTitle());
1927 
1928  h_Wenu_Eopdiff_vs_p[region]->Add(h_Wenu_meanEop_vs_p_plus[region], h_Wenu_meanEop_vs_p_minus[region], 1., -1);
1929  h_Wenu_Eopdiff_vs_invp[region]->Add(h_Wenu_meanEop_vs_invp_plus[region], h_Wenu_meanEop_vs_invp_minus[region],
1930  1., -1);
1931  h_Wenu_Eopdiff_vs_E[region]->Add(h_Wenu_meanEop_vs_E_plus[region], h_Wenu_meanEop_vs_E_minus[region], 1., -1);
1932  h_Wenu_Eopdiff_vs_phi[region]->Add(h_Wenu_meanEop_vs_phi_plus[region], h_Wenu_meanEop_vs_phi_minus[region], 1.,
1933  -1);
1934  h_Wenu_Eopdiff_vs_eta[region]->Add(h_Wenu_meanEop_vs_eta_plus[region], h_Wenu_meanEop_vs_eta_minus[region], 1.,
1935  -1);
1936  }
1937  }
1938 
1939  for (int region = 0; region != Nregions; ++region) {
1940  h_Wenu_Eopdiff[region]->Write("", TObject::kOverwrite);
1941  if (region == incl) {
1942  h_Wenu_Eopdiff_vs_p[region]->Write("", TObject::kOverwrite);
1943  h_Wenu_Eopdiff_vs_invp[region]->Write("", TObject::kOverwrite);
1944  h_Wenu_Eopdiff_vs_E[region]->Write("", TObject::kOverwrite);
1945  h_Wenu_Eopdiff_vs_phi[region]->Write("", TObject::kOverwrite);
1946  h_Wenu_Eopdiff_vs_eta[region]->Write("", TObject::kOverwrite);
1947  }
1948  }
1949 
1950  f->Write();
1951  }

◆ fitMergedFile_IDPerfMonZee()

void dqutils::MonitoringFile::fitMergedFile_IDPerfMonZee ( TFile *  f,
const std::string &  run_dir,
const std::string &  TriggerName 
)
static

Definition at line 1553 of file MonitoringFile_IDPerfPostProcess.cxx.

1554  {
1555  std::string path;
1556  path = run_dir + "IDPerfMon/Zee/" + TriggerName;
1557  if (f->cd(path.c_str()) == 0) {
1558  //std::cerr << "MonitoringFile::fitMergedFile_IDPerfMonZee(): "
1559  //<< "No such directory \"" << path << "\"\n";
1560  return;
1561  }
1562 
1563  f->cd(path.c_str());
1564 
1565  if (!CheckHistogram(f, (path + "/Zee_invmass").c_str())) return;
1566 
1567  TH1F* h_mass = (TH1F*) (f->Get((path + "/Zee_invmass").c_str())->Clone());
1568  if (CheckHistogram(f, (path + "/Nevents").c_str())) {
1569  TH1F* h_Nevents = (TH1F*) f->Get((path + "/Nevents").c_str());
1570  TH1F* h_rate = new TH1F("rate", "production rate", 1, 0, 1);
1571  double Ntot = h_Nevents->GetEntries();
1572  double yield = h_mass->Integral(h_mass->FindBin(80), h_mass->FindBin(105));
1573  double rate = yield / Ntot;
1574  double rate_error = sqrt(1 / yield + 1 / Ntot) * yield / Ntot;
1575  h_rate->SetBinContent(1, rate);
1576  h_rate->SetBinError(1, rate_error);
1577  h_rate->Write("", TObject::kOverwrite);
1578  }
1579 // TH1F* h_mass_scaled = (TH1F*)(f->Get((path+"/Zee_trk_invmass").c_str())->Clone("Zee_trk_invmass_scaled_copy"));
1580 // TString title(h_mass_scaled->GetTitle());
1581 // if (CheckHistogram(f,(path+"/Zee_trk_invmass_scaled").c_str())) {
1582 // if (CheckHistogram(f,(path+"/Nevents").c_str())) {
1583 // TH1F* h_Nevents=(TH1F*)f->Get((path+"/Nevents").c_str());
1584 // double Ntot =h_Nevents->GetEntries();
1585 // if (Ntot!=0.) h_mass_scaled->Scale(1./Ntot);
1586 // h_mass_scaled->SetTitle(title+" (per event)");
1587 // h_mass_scaled->Write("Zee_trk_invmass_scaled",TObject::kOverwrite);
1588 // }
1589 // }
1590 // delete h_mass_scaled;
1591 
1592  enum eta_region {
1593  incl, barrel, eca, ecc, Nregions
1594  };
1595  std::vector<std::string> region_strings;
1596  region_strings.push_back("incl");
1597  region_strings.push_back("barrel");
1598  region_strings.push_back("eca");
1599  region_strings.push_back("ecc");
1600 
1601  std::vector<TH1F*> h_Zee_Eopdiff;
1602  std::vector<TH1F*> h_Zee_Eop_plus;
1603  std::vector<TH1F*> h_Zee_Eop_minus;
1604 
1605  std::vector<TProfile*> h_Zee_Eopdiff_vs_p;
1606  std::vector<TProfile*> h_Zee_meanEop_vs_p_plus;
1607  std::vector<TProfile*> h_Zee_meanEop_vs_p_minus;
1608 
1609  std::vector<TProfile*> h_Zee_Eopdiff_vs_invp;
1610  std::vector<TProfile*> h_Zee_meanEop_vs_invp_plus;
1611  std::vector<TProfile*> h_Zee_meanEop_vs_invp_minus;
1612 
1613  std::vector<TProfile*> h_Zee_Eopdiff_vs_E;
1614  std::vector<TProfile*> h_Zee_meanEop_vs_E_plus;
1615  std::vector<TProfile*> h_Zee_meanEop_vs_E_minus;
1616 
1617  std::vector<TProfile*> h_Zee_Eopdiff_vs_phi;
1618  std::vector<TProfile*> h_Zee_meanEop_vs_phi_plus;
1619  std::vector<TProfile*> h_Zee_meanEop_vs_phi_minus;
1620 
1621  std::vector<TProfile*> h_Zee_Eopdiff_vs_eta;
1622  std::vector<TProfile*> h_Zee_meanEop_vs_eta_plus;
1623  std::vector<TProfile*> h_Zee_meanEop_vs_eta_minus;
1624 
1625  std::string str;
1626 
1627  for (int region = 0; region != Nregions; ++region) {
1628  str = path + "/Zee_Eop_plus_" + region_strings[region];
1629  if (!CheckHistogram(f, str.c_str())) return;
1630 
1631  h_Zee_Eop_plus.push_back((TH1F*) (f->Get(str.c_str())));
1632  h_Zee_Eop_plus[region]->SetTitle(h_Zee_Eop_plus[region]->GetTitle());
1633  str = path + "/Zee_Eop_minus_" + region_strings[region];
1634  if (!CheckHistogram(f, str.c_str())) return;
1635 
1636  h_Zee_Eop_minus.push_back((TH1F*) (f->Get(str.c_str())));
1637  h_Zee_Eop_minus[region]->SetTitle(h_Zee_Eop_minus[region]->GetTitle());
1638  str = path + "/Zee_Eopdiff_" + region_strings[region];
1639  if (!CheckHistogram(f, str.c_str())) return;
1640 
1641  h_Zee_Eopdiff.push_back((TH1F*) (f->Get(str.c_str())));
1642  h_Zee_Eopdiff[region]->SetTitle(h_Zee_Eopdiff[region]->GetTitle());
1643 
1644  h_Zee_Eopdiff[region]->Add(h_Zee_Eop_plus[region], h_Zee_Eop_minus[region], 1., -1);
1645 
1646  if (region == incl) {
1647  str = path + "/Zee_meanEop_vs_p_plus";
1648  if (!CheckHistogram(f, str.c_str())) return;
1649 
1650  h_Zee_meanEop_vs_p_plus.push_back((TProfile*) (f->Get(str.c_str())));
1651  h_Zee_meanEop_vs_p_plus[region]->SetTitle(h_Zee_meanEop_vs_p_plus[region]->GetTitle());
1652  str = path + "/Zee_meanEop_vs_p_minus";
1653  if (!CheckHistogram(f, str.c_str())) return;
1654 
1655  h_Zee_meanEop_vs_p_minus.push_back((TProfile*) (f->Get(str.c_str())));
1656  h_Zee_meanEop_vs_p_minus[region]->SetTitle(h_Zee_meanEop_vs_p_minus[region]->GetTitle());
1657  str = path + "/Zee_Eopdiff_vs_p";
1658  if (!CheckHistogram(f, str.c_str())) return;
1659 
1660  h_Zee_Eopdiff_vs_p.push_back((TProfile*) (f->Get(str.c_str())));
1661  h_Zee_Eopdiff_vs_p[region]->SetTitle(h_Zee_Eopdiff_vs_p[region]->GetTitle());
1662 
1663  str = path + "/Zee_meanEop_vs_invp_plus";
1664  if (!CheckHistogram(f, str.c_str())) return;
1665 
1666  h_Zee_meanEop_vs_invp_plus.push_back((TProfile*) (f->Get(str.c_str())));
1667  h_Zee_meanEop_vs_invp_plus[region]->SetTitle(h_Zee_meanEop_vs_invp_plus[region]->GetTitle());
1668  str = path + "/Zee_meanEop_vs_invp_minus";
1669  if (!CheckHistogram(f, str.c_str())) return;
1670 
1671  h_Zee_meanEop_vs_invp_minus.push_back((TProfile*) (f->Get(str.c_str())));
1672  h_Zee_meanEop_vs_invp_minus[region]->SetTitle(h_Zee_meanEop_vs_invp_minus[region]->GetTitle());
1673  str = path + "/Zee_Eopdiff_vs_invp";
1674  if (!CheckHistogram(f, str.c_str())) return;
1675 
1676  h_Zee_Eopdiff_vs_invp.push_back((TProfile*) (f->Get(str.c_str())));
1677  h_Zee_Eopdiff_vs_invp[region]->SetTitle(h_Zee_Eopdiff_vs_invp[region]->GetTitle());
1678 
1679  str = path + "/Zee_meanEop_vs_E_plus";
1680  if (!CheckHistogram(f, str.c_str())) return;
1681 
1682  h_Zee_meanEop_vs_E_plus.push_back((TProfile*) (f->Get(str.c_str())));
1683  h_Zee_meanEop_vs_E_plus[region]->SetTitle(h_Zee_meanEop_vs_E_plus[region]->GetTitle());
1684  str = path + "/Zee_meanEop_vs_E_minus";
1685  if (!CheckHistogram(f, str.c_str())) return;
1686 
1687  h_Zee_meanEop_vs_E_minus.push_back((TProfile*) (f->Get(str.c_str())));
1688  h_Zee_meanEop_vs_E_minus[region]->SetTitle(h_Zee_meanEop_vs_E_minus[region]->GetTitle());
1689  str = path + "/Zee_Eopdiff_vs_E";
1690  if (!CheckHistogram(f, str.c_str())) return;
1691 
1692  h_Zee_Eopdiff_vs_E.push_back((TProfile*) (f->Get(str.c_str())));
1693  h_Zee_Eopdiff_vs_E[region]->SetTitle(h_Zee_Eopdiff_vs_E[region]->GetTitle());
1694 
1695  str = path + "/Zee_meanEop_vs_phi_plus";
1696  if (!CheckHistogram(f, str.c_str())) return;
1697 
1698  h_Zee_meanEop_vs_phi_plus.push_back((TProfile*) (f->Get(str.c_str())));
1699  h_Zee_meanEop_vs_phi_plus[region]->SetTitle(h_Zee_meanEop_vs_phi_plus[region]->GetTitle());
1700  str = path + "/Zee_meanEop_vs_phi_minus";
1701  if (!CheckHistogram(f, str.c_str())) return;
1702 
1703  h_Zee_meanEop_vs_phi_minus.push_back((TProfile*) (f->Get(str.c_str())));
1704  h_Zee_meanEop_vs_phi_minus[region]->SetTitle(h_Zee_meanEop_vs_phi_minus[region]->GetTitle());
1705  str = path + "/Zee_Eopdiff_vs_phi";
1706  if (!CheckHistogram(f, str.c_str())) return;
1707 
1708  h_Zee_Eopdiff_vs_phi.push_back((TProfile*) (f->Get(str.c_str())));
1709  h_Zee_Eopdiff_vs_phi[region]->SetTitle(h_Zee_Eopdiff_vs_phi[region]->GetTitle());
1710 
1711  str = path + "/Zee_meanEop_vs_eta_plus";
1712  if (!CheckHistogram(f, str.c_str())) return;
1713 
1714  h_Zee_meanEop_vs_eta_plus.push_back((TProfile*) (f->Get(str.c_str())));
1715  h_Zee_meanEop_vs_eta_plus[region]->SetTitle(h_Zee_meanEop_vs_eta_plus[region]->GetTitle());
1716  str = path + "/Zee_meanEop_vs_eta_minus";
1717  if (!CheckHistogram(f, str.c_str())) return;
1718 
1719  h_Zee_meanEop_vs_eta_minus.push_back((TProfile*) (f->Get(str.c_str())));
1720  h_Zee_meanEop_vs_eta_minus[region]->SetTitle(h_Zee_meanEop_vs_eta_minus[region]->GetTitle());
1721  str = path + "/Zee_Eopdiff_vs_eta";
1722  if (!CheckHistogram(f, str.c_str())) return;
1723 
1724  h_Zee_Eopdiff_vs_eta.push_back((TProfile*) (f->Get(str.c_str())));
1725  h_Zee_Eopdiff_vs_eta[region]->SetTitle(h_Zee_Eopdiff_vs_eta[region]->GetTitle());
1726 
1727  h_Zee_Eopdiff_vs_p[region]->Add(h_Zee_meanEop_vs_p_plus[region], h_Zee_meanEop_vs_p_minus[region], 1., -1);
1728  h_Zee_Eopdiff_vs_invp[region]->Add(h_Zee_meanEop_vs_invp_plus[region], h_Zee_meanEop_vs_invp_minus[region], 1.,
1729  -1);
1730  h_Zee_Eopdiff_vs_E[region]->Add(h_Zee_meanEop_vs_E_plus[region], h_Zee_meanEop_vs_E_minus[region], 1., -1);
1731  h_Zee_Eopdiff_vs_phi[region]->Add(h_Zee_meanEop_vs_phi_plus[region], h_Zee_meanEop_vs_phi_minus[region], 1.,
1732  -1);
1733  h_Zee_Eopdiff_vs_eta[region]->Add(h_Zee_meanEop_vs_eta_plus[region], h_Zee_meanEop_vs_eta_minus[region], 1.,
1734  -1);
1735  }
1736  }
1737 
1738  for (int region = 0; region != Nregions; ++region) {
1739  h_Zee_Eopdiff[region]->Write("", TObject::kOverwrite);
1740  if (region == incl) {
1741  h_Zee_Eopdiff_vs_p[region]->Write("", TObject::kOverwrite);
1742  h_Zee_Eopdiff_vs_invp[region]->Write("", TObject::kOverwrite);
1743  h_Zee_Eopdiff_vs_E[region]->Write("", TObject::kOverwrite);
1744  h_Zee_Eopdiff_vs_phi[region]->Write("", TObject::kOverwrite);
1745  h_Zee_Eopdiff_vs_eta[region]->Write("", TObject::kOverwrite);
1746  }
1747  }
1748 
1749  f->Write();
1750  }

◆ fitMergedFile_IDPerfMonZMM()

void dqutils::MonitoringFile::fitMergedFile_IDPerfMonZMM ( TFile *  f,
const std::string &  run_dir,
const std::string &  TriggerName 
)
static

Definition at line 1954 of file MonitoringFile_IDPerfPostProcess.cxx.

1955  {
1956  std::string path;
1957  std::vector<TH1F*> hvec;
1958  gROOT->SetStyle("Plain");
1959 
1960  path = run_dir + "IDPerfMon/ZMM/" + TriggerName;
1961  //std::cout <<" ZMM path: "<< path << std::endl;
1962  if (f->cd(path.c_str()) == 0) {
1963  //std::cerr << "MonitoringFile::fitMergedFile_IDPerfMonZMM(): "
1964  //<< "No such directory \"" << path << "\"\n";
1965  return;
1966  }
1967  f->cd(path.c_str());
1968 
1969 
1970 
1971  // CB ---------
1972  TH1F* h_ZMass_CB_Shift_vs_Regions = new TH1F("Z_Mass_CB_Shift_vs_Regions", "Z_Mass_CB Shift vs. Regions", 4, 0.5,
1973  4.5);
1974  TH1F* h_ZMass_CB_Width_vs_Regions = new TH1F("Z_Mass_CB_Width_vs_Regions", "Z_Mass_CB Width vs. Regions", 4, 0.5,
1975  4.5);
1976 
1977  if (!CheckHistogram(f, (path + "/Z_Mass_CB_All").c_str()) ||
1978  !CheckHistogram(f, (path + "/Z_Mass_CB_BB").c_str()) ||
1979  !CheckHistogram(f, (path + "/Z_Mass_CB_BE").c_str()) ||
1980  !CheckHistogram(f, (path + "/Z_Mass_CB_EE").c_str())) return;
1981 
1982  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_CB_All").c_str())->Clone()));
1983  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_CB_BB").c_str())->Clone()));
1984  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_CB_BE").c_str())->Clone()));
1985  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_CB_EE").c_str())->Clone()));
1986  fitZmumuHistograms(h_ZMass_CB_Shift_vs_Regions, h_ZMass_CB_Width_vs_Regions, hvec);
1987  hvec.clear();
1988  h_ZMass_CB_Shift_vs_Regions->SetStats(0);
1989  h_ZMass_CB_Width_vs_Regions->SetStats(0);
1990  h_ZMass_CB_Shift_vs_Regions->Write("", TObject::kOverwrite);
1991  h_ZMass_CB_Width_vs_Regions->Write("", TObject::kOverwrite);
1992 
1993  // ID ----------
1994  TH1F* h_ZMass_ID_Shift_vs_Regions = new TH1F("Z_Mass_ID_Shift_vs_Regions", "Z_Mass_ID Shift vs. Regions", 4, 0.5,
1995  4.5);
1996  TH1F* h_ZMass_ID_Width_vs_Regions = new TH1F("Z_Mass_ID_Width_vs_Regions", "Z_Mass_ID Width vs. Regions", 4, 0.5,
1997  4.5);
1998 
1999  if (!CheckHistogram(f, (path + "/Z_Mass_ID_All").c_str()) ||
2000  !CheckHistogram(f, (path + "/Z_Mass_ID_BB").c_str()) ||
2001  !CheckHistogram(f, (path + "/Z_Mass_ID_BE").c_str()) ||
2002  !CheckHistogram(f, (path + "/Z_Mass_ID_EE").c_str())) return;
2003 
2004  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_ID_All").c_str())->Clone()));
2005  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_ID_BB").c_str())->Clone()));
2006  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_ID_BE").c_str())->Clone()));
2007  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_ID_EE").c_str())->Clone()));
2008  fitZmumuHistograms(h_ZMass_ID_Shift_vs_Regions, h_ZMass_ID_Width_vs_Regions, hvec);
2009  hvec.clear();
2010  h_ZMass_ID_Shift_vs_Regions->SetStats(0);
2011  h_ZMass_ID_Width_vs_Regions->SetStats(0);
2012  h_ZMass_ID_Shift_vs_Regions->Write("", TObject::kOverwrite);
2013  h_ZMass_ID_Width_vs_Regions->Write("", TObject::kOverwrite);
2014 
2015  // ME -----------
2016  TH1F* h_ZMass_ME_Shift_vs_Regions = new TH1F("Z_Mass_ME_Shift_vs_Regions", "Z_Mass_ME Shift vs. Regions", 4, 0.5,
2017  4.5);
2018  TH1F* h_ZMass_ME_Width_vs_Regions = new TH1F("Z_Mass_ME_Width_vs_Regions", "Z_Mass_ME Width vs. Regions", 4, 0.5,
2019  4.5);
2020 
2021  if (!CheckHistogram(f, (path + "/Z_Mass_ME_All").c_str()) ||
2022  !CheckHistogram(f, (path + "/Z_Mass_ME_BB").c_str()) ||
2023  !CheckHistogram(f, (path + "/Z_Mass_ME_BE").c_str()) ||
2024  !CheckHistogram(f, (path + "/Z_Mass_ME_EE").c_str())) return;
2025 
2026  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_ME_All").c_str())->Clone()));
2027  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_ME_BB").c_str())->Clone()));
2028  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_ME_BE").c_str())->Clone()));
2029  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_ME_EE").c_str())->Clone()));
2030  fitZmumuHistograms(h_ZMass_ME_Shift_vs_Regions, h_ZMass_ME_Width_vs_Regions, hvec);
2031  hvec.clear();
2032  h_ZMass_ME_Shift_vs_Regions->SetStats(0);
2033  h_ZMass_ME_Width_vs_Regions->SetStats(0);
2034  h_ZMass_ME_Shift_vs_Regions->Write("", TObject::kOverwrite);
2035  h_ZMass_ME_Width_vs_Regions->Write("", TObject::kOverwrite);
2036 
2037  // MS -----------
2038  TH1F* h_ZMass_MS_Shift_vs_Regions = new TH1F("Z_Mass_MS_Shift_vs_Regions", "Z_Mass_MS Shift vs. Regions", 4, 0.5,
2039  4.5);
2040  TH1F* h_ZMass_MS_Width_vs_Regions = new TH1F("Z_Mass_MS_Width_vs_Regions", "Z_Mass_MS Width vs. Regions", 4, 0.5,
2041  4.5);
2042 
2043 
2044  if (!CheckHistogram(f, (path + "/Z_Mass_MS_All").c_str()) ||
2045  !CheckHistogram(f, (path + "/Z_Mass_MS_BB").c_str()) ||
2046  !CheckHistogram(f, (path + "/Z_Mass_MS_BE").c_str()) ||
2047  !CheckHistogram(f, (path + "/Z_Mass_MS_EE").c_str())) return;
2048 
2049  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_MS_All").c_str())->Clone()));
2050  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_MS_BB").c_str())->Clone()));
2051  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_MS_BE").c_str())->Clone()));
2052  hvec.push_back((TH1F*) (f->Get((path + "/Z_Mass_MS_EE").c_str())->Clone()));
2053  fitZmumuHistograms(h_ZMass_MS_Shift_vs_Regions, h_ZMass_MS_Width_vs_Regions, hvec);
2054  hvec.clear();
2055  h_ZMass_MS_Shift_vs_Regions->SetStats(0);
2056  h_ZMass_MS_Width_vs_Regions->SetStats(0);
2057  h_ZMass_MS_Shift_vs_Regions->Write("", TObject::kOverwrite);
2058  h_ZMass_MS_Width_vs_Regions->Write("", TObject::kOverwrite);
2059 
2060 
2061 
2062  // OLD naming style plots
2063  if (!CheckHistogram(f, (path + "/z-mass_trks").c_str())) return;
2064 
2065  TH1F* h_ZMass_ID = (TH1F*) (f->Get((path + "/z-mass_trks").c_str())->Clone());
2066  h_ZMass_ID->SetTitle("Z Mass ID Tracks");
2067  //fitZmumuMassPlot(h_ZMass_ID);
2068  //h_ZMass_ID->Write("",TObject::kOverwrite);
2069 
2070  if (!CheckHistogram(f, (path + "/z-mass_comb").c_str())) return;
2071 
2072  TH1F* h_ZMass_CB = (TH1F*) (f->Get((path + "/z-mass_comb").c_str())->Clone());
2073  h_ZMass_CB->SetTitle("Z Mass CB Tracks");
2074  //fitZmumuMassPlot(h_ZMass_CB);
2075  //h_ZMass_CB->Write("",TObject::kOverwrite);
2076 
2077 
2078  if (CheckHistogram(f, (path + "/Nevents").c_str())) {
2079  TH1F* h_Nevents = (TH1F*) f->Get((path + "/Nevents").c_str());
2080  TH1F* h_rate = new TH1F("rate", "production rate", 1, 0, 1);
2081  double Ntot = h_Nevents->GetEntries();
2082  double yield = h_ZMass_ID->Integral(h_ZMass_ID->FindBin(80), h_ZMass_ID->FindBin(105));
2083  double rate = yield / Ntot;
2084  double rate_error = sqrt(1 / yield + 1 / Ntot) * yield / Ntot;
2085  //std::cout <<" rate: "<< rate <<" rate_error: "<< rate_error <<std::endl;
2086  h_rate->SetBinContent(1, rate);
2087  h_rate->SetBinError(1, rate_error);
2088  h_rate->Write("rate", TObject::kOverwrite);
2089  }
2090 
2091  f->Write();
2092  }

◆ fitUpsilonHistograms()

void dqutils::MonitoringFile::fitUpsilonHistograms ( TH1F *  hmass,
TH1F *  hwidth,
TH1F *  h1[],
int  n 
)
static

Definition at line 2151 of file MonitoringFile_IDPerfPostProcess.cxx.

2152  {
2153  double upsilonPDGmass = 9.46;
2154  double mass = 0;
2155  double mass_error = 0;
2156  double width = 0;
2157  double width_error = 0;
2158  double maxmass = 0.;
2159  double maxwidth = 0.;
2160  double minwidth = 999;
2161 
2162  hmass->SetMarkerStyle(21);
2163  hwidth->SetMarkerStyle(21);
2164 // TF1 *fitupsi = new TF1("fitupsi","gaus",9.,10.);
2165 // fitupsi->SetParNames("Constant","Mean","Width");
2166  TF1* fitupsi = new TF1("fitupsi", "gaus(0)+pol1(3)", 8.5, 10.5);
2167  fitupsi->SetParNames("Constant", "Mean", "Sigma", "Constant", "Slope");
2168  fitupsi->SetLineColor(2);
2169  for (int i = 0; i < n; i++) {
2170  if (h1[i]->GetEntries() > 20) {
2171  double max = h1[i]->GetBinContent(h1[i]->GetMaximumBin());
2172  fitupsi->SetParameter(1, 9.46);
2173  fitupsi->SetParameter(2, 0.15);
2174  fitupsi->SetParLimits(1, 8., 11.);
2175  fitupsi->SetParLimits(2, 0., 0.5);
2176  fitupsi->SetParameter(0, max);
2177  h1[i]->SetMarkerStyle(21);
2178  h1[i]->Fit("fitupsi", "RQM");
2179  mass = fitupsi->GetParameter(1) - upsilonPDGmass;
2180  mass_error = fitupsi->GetParError(1);
2181  width = fitupsi->GetParameter(2);
2182  width_error = fitupsi->GetParError(2);
2183  hmass->SetBinContent(i + 1, mass);
2184  hmass->SetBinError(i + 1, mass_error);
2185  hwidth->SetBinContent(i + 1, width);
2186  hwidth->SetBinError(i + 1, width_error);
2187  if ((fabs(mass) + mass_error) > maxmass) maxmass = fabs(mass) + mass_error;
2188  if ((fabs(width) + width_error) > maxwidth) maxwidth = fabs(width) + width_error;
2189  if ((fabs(width) - width_error) < minwidth) minwidth = fabs(width) - width_error;
2190  }
2191  }
2192  if (maxmass > 0.1) maxmass = 0.1;
2193  if (maxwidth > 0.4) maxwidth = 0.4;
2194  if (minwidth < 0.) minwidth = 0.;
2195  hmass->SetAxisRange(-maxmass * 1.05, maxmass * 1.05, "Y");
2196  if (minwidth < maxwidth) hwidth->SetAxisRange(minwidth * 0.9, maxwidth * 1.05, "Y");
2197 
2198  delete fitupsi;
2199  }

◆ fitZmumuHistograms()

void dqutils::MonitoringFile::fitZmumuHistograms ( TH1F *  hmass,
TH1F *  hwidth,
std::vector< TH1F * >  hvec 
)
static

Definition at line 2201 of file MonitoringFile_IDPerfPostProcess.cxx.

2201  {
2202  const double ZPDGmass = 91.1876;
2203  const int size = (int) hvec.size();
2204 
2205  for (int i = 0; i < size; i++) {
2206  double mass = fitZmumuMass(hvec[i]).first.getVal() - ZPDGmass;
2207  double mass_err = fitZmumuMass(hvec[i]).first.getError();
2208  double width = fitZmumuMass(hvec[i]).second.getVal();
2209  double width_err = fitZmumuMass(hvec[i]).second.getError();
2210 
2211  hmass->SetBinContent(i + 1, mass);
2212  hmass->SetBinError(i + 1, mass_err);
2213  hmass->GetXaxis()->SetBinLabel(i + 1, hvec[i]->GetName());
2214  hmass->GetXaxis()->SetTitle("Different Detector Regions");
2215  hmass->SetAxisRange(-3.0, 3.0, "Y");
2216 
2217  hwidth->SetBinContent(i + 1, width);
2218  hwidth->SetBinError(i + 1, width_err);
2219  hwidth->GetXaxis()->SetBinLabel(i + 1, hvec[i]->GetName());
2220  hwidth->GetXaxis()->SetTitle("Different Detector Regions");
2221  hwidth->SetAxisRange(0, 8, "Y");
2222  }
2223  }

◆ fitZmumuMass()

std::pair< RooRealVar, RooRealVar > dqutils::MonitoringFile::fitZmumuMass ( TH1F *  hmass)
static

Definition at line 2225 of file MonitoringFile_IDPerfPostProcess.cxx.

2225  {
2226  // gROOT->ProcessLine("gErrorIgnoreLevel=1001;");
2227  RooAbsPdf::verboseEval(-100); //sami in order to make roofit quiet
2228  RooRealVar m("mass", "dimuon invariable mass", 91.2, 60., 120., "GeV");
2229  RooDataHist* data = 0;
2230  data = new RooDataHist("data", "data", m, hmass);
2231  RooRealVar bwm0("bw_#mu", "bw_#mu", 91.2, 85., 95.);
2232  RooRealVar bwsg("bw_#sigma", "bw_#sigma", 2.4952);
2233  RooBreitWigner bw("bw", "bw", m, bwm0, bwsg);
2234 
2235  RooRealVar cbm0("cb_#mu", "cb_#mu", 0);
2236  RooRealVar cbsg("cb_#sigma", "cb_#sigma", 5., 0.1, 10.);
2237  RooRealVar cbal("cb_#alpha", "cb_#alpha", 1.5, 0.1, 10.);
2238  RooRealVar cbn("cb_n", "cb_n", 1.5, 0.01, 10.);
2239  RooCBShape cb("cb", "cb", m, cbm0, cbsg, cbal, cbn);
2240 
2241  m.setBins(5000);
2242  RooFFTConvPdf bxc("bxc", "BW (X) CB", m, bw, cb);
2243  auto resourceToDelete = bxc.fitTo(*data, RooFit::PrintLevel(-1), RooFit::PrintEvalErrors(-1), RooFit::Warnings(kFALSE));
2244 
2245  RooArgSet* params = bxc.getVariables();
2246  //params->Print("v");
2247  RooRealVar* fit_bwm0 = (RooRealVar*) params->find("bw_#mu");
2248  RooRealVar* fit_cbsg = (RooRealVar*) params->find("cb_#sigma");
2249  //double vfit_bwm0 = fit_bwm0->getVal();
2250  //double vfit_cbsg = fit_cbsg->getVal();
2251  //std::cout <<" vfit_bwm0: "<< vfit_bwm0 << " vfit_cbsg: " << vfit_cbsg << std::endl;
2252  delete data;
2253  delete resourceToDelete;
2254  return std::make_pair(*fit_bwm0, *fit_cbsg);
2255  }

◆ fitZmumuMassPlot()

void dqutils::MonitoringFile::fitZmumuMassPlot ( TH1F *  hmass)
static

Definition at line 2258 of file MonitoringFile_IDPerfPostProcess.cxx.

2258  {
2259  // gROOT->ProcessLine("gErrorIgnoreLevel=1001;");
2260  RooAbsPdf::verboseEval(-100); //sami in order to make roofit quiet
2261  RooRealVar m("mass", "dimuon invariable mass", 91.2, 60., 120., "GeV");
2262  RooDataHist* data = 0;
2263  data = new RooDataHist("data", "data", m, hmass);
2264  RooRealVar bwm0("bw_#mu", "bw_#mu", 91.2, 85., 95.);
2265  RooRealVar bwsg("bw_#sigma", "bw_#sigma", 2.4952);
2266  RooBreitWigner bw("bw", "bw", m, bwm0, bwsg);
2267 
2268  RooRealVar cbm0("cb_#mu", "cb_#mu", 0);
2269  RooRealVar cbsg("cb_#sigma", "cb_#sigma", 5., 0.1, 10.);
2270  RooRealVar cbal("cb_#alpha", "cb_#alpha", 1.5, 0.1, 10.);
2271  RooRealVar cbn("cb_n", "cb_n", 1.5, 0.01, 10.);
2272  RooCBShape cb("cb", "cb", m, cbm0, cbsg, cbal, cbn);
2273 
2274  m.setBins(5000);
2275  RooFFTConvPdf bxc("bxc", "BW (X) CB", m, bw, cb);
2276  auto resourceToDelete = bxc.fitTo(*data, RooFit::PrintLevel(-1), RooFit::PrintEvalErrors(-1), RooFit::Warnings(kFALSE));
2277  RooPlot* frame = m.frame();
2278  data->plotOn(frame, RooFit::MarkerSize(0.9));
2279  bxc.paramOn(frame, RooFit::Format("NELU", RooFit::AutoPrecision(2)), RooFit::Layout(0.1, 0.4, 0.9));
2280  bxc.plotOn(frame, RooFit::LineColor(kYellow));
2281  cb.plotOn(frame, RooFit::LineColor(kRed));
2282  bw.plotOn(frame, RooFit::LineStyle(kDashed));
2283  delete data;
2284  delete resourceToDelete;
2285  }

◆ getAllDirs()

static void dqutils::MonitoringFile::getAllDirs ( DirMap_t dirmap,
TDirectory *  dir,
const std::string &  dirName 
)
static

◆ getCompressionLevel()

static int dqutils::MonitoringFile::getCompressionLevel ( )
inlinestatic

Definition at line 458 of file MonitoringFile.h.

458 {return m_fileCompressionLevel;}

◆ getDebugLevel()

static int dqutils::MonitoringFile::getDebugLevel ( )
static

◆ getHanResults()

static std::string dqutils::MonitoringFile::getHanResults ( const std::string &  hanResultsDir,
const std::string &  input,
const std::string &  hcfg,
const std::string &  hcfg_min10,
const std::string &  hcfg_min30 
)
static

◆ getIndentation()

static std::string dqutils::MonitoringFile::getIndentation ( const std::string &  pathName,
const std::string &  leadingSpace = "" 
)
staticprotected

◆ getMedian()

float dqutils::MonitoringFile::getMedian ( TH1 *  h1)
static

Definition at line 3678 of file MonitoringFile_IDAlignPostProcess.cxx.

3679  {
3680  //calculates median for a TH1
3681 
3682  int nBins = h1->GetXaxis()->GetNbins();
3683 
3684  //double x[nBins]; double y[nBins];
3685  std::vector<double> x;
3686  std::vector<double> y;
3687  // double x[10000]; double y[10000];
3688  for (int i = 1; i != nBins + 1; i++) {
3689  //x[i] = h1->GetBinCenter(i);
3690  //y[i] = h1->GetBinContent(i);
3691  x.push_back(h1->GetBinCenter(i));
3692  y.push_back(h1->GetBinContent(i));
3693  }
3694 
3695  //float median = TMath::Median(nBins,x,y);
3696  float median = TMath::Median(nBins, &x[0], &y[0]);
3697 
3698  return median;
3699  }

◆ getNumBins()

Int_t dqutils::MonitoringFile::getNumBins ( const TH1 &  hist)
staticprivate

Definition at line 47 of file MonitoringFile_MergeAlgs.cxx.

47  {
48  // Return number of histogram bins in ROOT 1-dim projection scheme
49  // Allow loops on multi-dim histograms without regard for dimensionality
50  Int_t dim = hist.GetDimension();
51 
52  if (dim == 1) {
53  return(hist.GetNbinsX() + 2);
54  }
55  if (dim == 2) {
56  return (hist.GetNbinsX() + 2) * (hist.GetNbinsY() + 2);
57  }
58  if (dim == 3) {
59  return (hist.GetNbinsX() + 2) * (hist.GetNbinsY() + 2) * (hist.GetNbinsZ() + 2);
60  }
61  return -1;
62  }

◆ getObjKey()

static TKey* dqutils::MonitoringFile::getObjKey ( TDirectory *  dir,
const std::string &  path 
)
static

◆ getPath()

static std::string dqutils::MonitoringFile::getPath ( TDirectory *  dir)
static

◆ getTGCNumberOfWires()

int dqutils::MonitoringFile::getTGCNumberOfWires ( const int  istationName,
const int  layer,
const int  istationEta,
const int  istationPhi 
)
static

Definition at line 1036 of file MonitoringFile_TGCPostProcess.cxx.

1037  {
1038  int nWire = 0;
1039 
1040  if (istationName == 42) { //TGC1 Endcap //41:T1F 42:T1E 43:T2F 44:T2E 45:T3F 46:T3E 47:T3F 48:T4E (T4 means inner
1041  // small wheel TGCs, EI/FI)
1042  if (layer == 0) {
1043  if (istationEta == 1) { // T3 (E4) wire 1ch-91ch (total 91ch)
1044  nWire = 92;
1045  } else if (istationEta == 2) { //T6 (E3) 91ch-152ch (62ch)
1046  nWire = 61;
1047  } else if (istationEta == 3) { //T7 (E2) 152ch-174ch (23ch)
1048  nWire = 23;
1049  } else if (istationEta == 4) { //T8 (E1) 173ch-196ch(24ch)
1050  nWire = 24;
1051  }
1052  } else if (layer == 1 || layer == 2) {
1053  if (istationEta == 1) { // T3 (E4) wire 1ch-91ch (total 91ch)
1054  nWire = 91;
1055  } else if (istationEta == 2) { //T6 (E3) 91ch-152ch (62ch)
1056  nWire = 62;
1057  } else if (istationEta == 3) { //T7 (E2) 152ch-174ch (23ch)
1058  nWire = 23;
1059  } else if (istationEta == 4) { //T8 (E1) 173ch-196ch(24ch)
1060  nWire = 24;
1061  }
1062  }
1063  } else if (istationName == 41) { // TGC1 Forward
1064  if (layer == 0 || layer == 2) nWire = 105;
1065  else if (layer == 1) nWire = 104;
1066  } else if (istationName == 44) { // TGC2 Endcap
1067  if (istationEta == 1) { // T4 (E5) wire 1ch-91ch (total 91ch)
1068  nWire = 110;
1069  } else if (istationEta == 2) { //T6 (E4) 109ch-211ch (103ch)
1070  nWire = 103;
1071  } else if (istationEta == 3) { //T7 (E3) 211ch-242ch (23ch)
1072  nWire = 32;
1073  } else if (istationEta == 4) { //T8 (E2) 241ch-272ch (32ch)
1074  nWire = 32;
1075  } else if (istationEta == 5) { //T9 (E1) 271ch-302ch(32ch)
1076  nWire = 32;
1077  }
1078  } else if (istationName == 43) { // TGC2 Forward
1079  nWire = 125;
1080  } else if (istationName == 46) { // TGC3 Endcap
1081  if (istationEta == 1) { // T5 (E5) wire 1ch-110ch (total 110ch)
1082  nWire = 96;
1083  } else if (istationEta == 2) { //T6 (E4) 95ch-200ch (106ch)
1084  nWire = 106;
1085  } else if (istationEta == 3) { //T7 (E3) 200ch-231ch (32ch)
1086  nWire = 32;
1087  } else if (istationEta == 4) { //T8 (E2) 231ch-2
1088  nWire = 30;
1089  } else if (istationEta == 5) { //T9 (E1) 260ch-290ch(31ch)
1090  nWire = 31;
1091  }
1092  } else if (istationName == 45) { // TGC3 Forward
1093  nWire = 122;
1094  } else if (istationName == 48) { // EI
1095  //stationPhi 1-8 -> 1-8
1096  // 9-15 -> 10-16
1097  // 16-18 -> 18-20
1098  // 19-21 -> 22-24
1099  if (istationPhi == 2 || istationPhi == 11 || istationPhi == 13 || istationPhi == 14 || istationPhi == 15 ||
1100  istationPhi == 16 || istationPhi == 20 || istationPhi == 21) {
1101  //short 16
1102  nWire = 16;
1103  } else {
1104  //long 24
1105  nWire = 24;
1106  }
1107  } else if (istationName == 47) { // FI
1108  if (istationPhi == 2 || istationPhi == 5 || istationPhi == 8 || istationPhi == 11 || istationPhi == 14 ||
1109  istationPhi == 17 || istationPhi == 20 || istationPhi == 23) {
1110  //short 30
1111  nWire = 30;
1112  } else {
1113  //long 32
1114  nWire = 32;
1115  }
1116  }
1117  return nWire;
1118  }

◆ HLTCaloAveragePtPhiEtaMaps()

void dqutils::MonitoringFile::HLTCaloAveragePtPhiEtaMaps ( TFile *  f,
TString &  run_dir 
)
static

Definition at line 24 of file MonitoringFile_HLTCaloAveragePtPhiEtaMaps.cxx.

24  {
26 
27  if (debugLevel > 1) std::cout << "--> HLTCaloAveragePtPhiEtaMaps: <Quantity(eta,phi)> = Quantity(eta,phi)/N(eta,phi) " << std::endl;
28 
29  f->cd("/");
30  TIter next_run(f->GetListOfKeys());
31  TKey* key_run(0);
32  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
33  if (!key_run->IsFolder()) continue;
34  run_dir = key_run->GetName();
35  if (!run_dir.Contains("run")) {
36  continue;
37  }
38 
39  std::string run_dir2 = run_dir.Data();
40 
41  // all merged root files have the structure "rootfile.root:/run_NNNNNNN"
42  // use that to extract run number
43  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
44  //run_number=run_number;
45 
46  // begin HLTMET
47  // note 1: prefix all dirs and hists with '/'
48  // note 2: missing dir => return
49  // note 3: missing hist => continue
50  TString hlt_top = run_dir + "/HLT"; // toplevel
51 
52  std::vector<TString> calo_fold;
53  std::vector<std::pair<TString, TString> > hist_numr;
54 
55  // The folders that we want to get the hists from
56  calo_fold.push_back("/CaloMon");
57  calo_fold.push_back("/CaloMonL2");
58 
59  // check if the folders are in hlt
60  for (std::vector<TString>::iterator it = calo_fold.begin(); it != calo_fold.end(); ++it) {
61  TString theHistDir = hlt_top + *it;
62  TDirectory* dir = f->GetDirectory(theHistDir);
63  if (!dir) {
64  if (debugLevel > 0) std::cerr << "--> HLTCaloAveragePtPhiEtaMaps: directory " << theHistDir << " not found" << std::endl;
65  return;
66  }
67  }
68 
69  // pairs of Num and Dem
70  hist_numr.push_back(std::make_pair<TString, TString>("/EnergyAccetaphiLAr", "/HitAccetaphiLAr"));
71  hist_numr.push_back(std::make_pair<TString, TString>("/EnergyAccetaphiTile", "/HitAccetaphiTile"));
72 
73 
74  // we have all dirs, get the component histograms
75  for (std::vector<TString>::iterator itFex = calo_fold.begin(); itFex != calo_fold.end(); ++itFex) {
76  for (std::vector<std::pair<TString, TString> >::iterator itNum = hist_numr.begin(); itNum != hist_numr.end(); ++itNum) {
77  TH2F* hnum(0), *hden(0);
78 
79  // prepend histogram name with path and append with suffix [_00 .., _24 for each component]
80  TString thePath = hlt_top + (*itFex);
81  TString numPath = thePath + (*itNum).first;
82  TString denPath = thePath + (*itNum).second;
83 
84  // get histograms
85  hnum = (TH2F*) (f->Get(numPath));
86  hden = (TH2F*) (f->Get(denPath));
87  // test if histograms are present
88  if (!hnum) {
89  if (debugLevel > 0) std::cerr << "--> HLTCaloAveragePtPhiEtaMaps: no histogram " << numPath << std::endl;
90  continue;
91  }
92  if (!hden) {
93  if (debugLevel > 0) std::cerr << "--> HLTCaloAveragePtPhiEtaMaps: no histogram " << denPath << std::endl;
94  continue;
95  }
96 
97 
98  // get directory of histograms
99  TDirectory* dir = f->GetDirectory(thePath);
100 
101  // these are disabled, because we have to worry about updating metadata
102  // clone numerator histogram in the same directory; prepend with "avg_"
103  // use numerator to do the job
104 
105  // divide num by den to get average quantity.
106  hnum->Divide(hnum, hden);
107 
108  // fix histogram titles
109  TString title = hnum->GetTitle();
110  hnum->SetTitle("Average Transverse Energy per eta/phi bin");
111 
112  dir->cd();
113  hnum->Write("", TObject::kOverwrite);
114  } // done looping over quantities
115  } // done looping over directories
116  } // end while loop over all keys
117  } // end method MonitoringFile::HLTCaloAveragePtPhiEtaMaps

◆ HLTCaloPostProcess()

void dqutils::MonitoringFile::HLTCaloPostProcess ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 16 of file MonitoringFile_HLTCaloPostProcess.cxx.

16  {
17  if (isIncremental == true) {
18  return;
19  }
20 
22  if (debugLevel > 1) {
23  std::cout << "--> HLTCaloPostProcess: Begin HLTCalo post-processing" << std::endl;
24  }
25 
26  //open root file
27  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
28 
29  //check files are loaded.
30  if (f == 0 || !f->IsOpen()) {
31  std::cerr << "--> HLTCaloPostProcess: Input file not opened" << std::endl;
32  return;
33  }
34 
35  if (f->IsZombie()) {
36  std::cerr << "--> HLTCaloPostProcess: Input file " << inFilename << " cannot be opened. " << std::endl;
37  return;
38  }
39 
40  //check file size is not too small.
41  if (f->GetSize() < 1000.) {
42  std::cerr << "--> HLTCaloPostProcess: Input file empty" << std::endl;
43  f->Close();
44  return;
45  }
46 
47  //start postprocessing
48  TString run_dir;
49  HLTCaloAveragePtPhiEtaMaps(f, run_dir);
50  //close root file
51  f->Close();
52  delete f;
53 
54  if (debugLevel > 1) {
55  std::cout << "--> HLTCaloPostProcess: End HLTCalo post-processing " << std::endl;
56  }
57 
58  return;
59  }

◆ HLTEgammaEfficiencyOff()

void dqutils::MonitoringFile::HLTEgammaEfficiencyOff ( TFile *  f,
TDirectory *  trig_dir,
TDirectory *  off_dir,
const TString &  pathNum,
const TString &  pathEff,
const std::vector< TString > &  varName 
)
static

Definition at line 28 of file MonitoringFile_HLTEgammaEfficiency.cxx.

30  {
31  //get the relevant paths
32  std::string chain_path = getPath(trig_dir);
33  std::string offline_path = getPath(off_dir);
34 
35  //establish base path (to save typing "/PassedChain/" over and over)
36  TString basePath = chain_path + "/PassedChain/";
37  if (f->cd(basePath.Data()) == 0) {
38  std::cerr << "----> HLTEgammaPostProcess: basePath not found in "
39  << chain_path << ", skipping now!\n";
40  return;
41  }
42 
43  //create histogram matrix with pointers to our histograms in question
44  // 3x3 matrix, rows are variables (Et, Eta, Phi), colums the different
45  // histograms (numerator - matched offline, denominator - offline, eff)
46  TH1F* histo_matrix[3][3];
47 
48  //check variables to avoid segfaults!
49  if (varName.size() > 3) {
50  std::cerr << "----> HLTEgammaPostProcess: Too many variables "
51  << "used in " << chain_path + "/PassedChain/" + pathEff
52  << " for bootstrap efficiencies, skipping now!\n";
53  return;
54  }
55 
56 
57 
58  for (uint iVar = 0; iVar < varName.size(); ++iVar) {
59  //form names for all variables
60  TString numName = basePath + pathNum + "eg" + varName[iVar];
61  TString denName = offline_path + "/" + "eg" + varName[iVar];
62  TString effName = basePath + pathEff + "eg" + varName[iVar];
63 
64  //check histogram existence
65  if (!CheckHistogram(f, numName.Data())) {
66  std::cerr << "----> HLTEgammaPostProcess: Histogram "
67  << numName << " does not exist in file "
68  << f->GetName() << " - skipping!\n";
69  return;
70  }
71  if (!CheckHistogram(f, denName.Data())) {
72  std::cerr << "----> HLTEgammaPostProcess: Histogram "
73  << denName << " does not exist in file "
74  << f->GetName() << " - skipping!\n";
75  return;
76  }
77  if (!CheckHistogram(f, effName.Data())) {
78  std::cerr << "----> HLTEgammaPostProcess: Histogram "
79  << effName << " does not exist in file "
80  << f->GetName() << " - skipping!\n";
81  return;
82  }
83 
84  //debug outs
85  //std::cout << "---->HLTEgammaPostProcess: Taking " << numName << " and divide by "
86  // << denName << " to get " << effName << std::endl;
87 
88  //now get histograms
89  histo_matrix[iVar][0] = (TH1F*) (f->Get(numName.Data()));
90  histo_matrix[iVar][1] = (TH1F*) (f->Get(denName.Data()));
91  histo_matrix[iVar][2] = (TH1F*) (f->Get(effName.Data()));
92 
93  //hop into efficiency path
94  TString writePath = basePath + pathEff;
95  f->cd(writePath.Data());
96 
97  //create efficiency histogram by division
98  histo_matrix[iVar][2]->Divide(histo_matrix[iVar][0], histo_matrix[iVar][1],
99  1.0, 1.0, "B");
100  histo_matrix[iVar][2]->Scale(100.);
101  if (histo_matrix[iVar][2]->Write("",
102  TObject::kOverwrite) ==
103  0) std::cerr << "----> HLTEgammaPostProcess: Efficiency histogram "
104  << effName <<
105  " not written! Histogram will be buggy!\n";
106  }
107 
108  //save results now
109  f->Write();
110  }

◆ HLTEgammaEfficiencyRel()

void dqutils::MonitoringFile::HLTEgammaEfficiencyRel ( TFile *  f,
TDirectory *  trig_dir,
const TString &  pathPre,
const TString &  pathRej,
const std::vector< TString > &  objStage,
const std::vector< TString > &  varName 
)
static

Definition at line 116 of file MonitoringFile_HLTEgammaEfficiency.cxx.

119  {
120  std::string chain_path = getPath(trig_dir);
121 
122  // std::cout << "----> HLTEgammaPostProcess in " << chain_path
123  // << ", pathPre=" << chain_path + "/PassedChain/" + pathPre
124  // << ", pathRej=" << chain_path + "/PassedChain/" + pathRej
125 
126  //establish base path (to save typing)
127  TString basePath = chain_path + "/PassedChain/";
128  if (f->cd(basePath.Data()) == 0) {
129  std::cerr << "----> HLTEgammaPostProcess: basePath not found in "
130  << chain_path << ", skipping now!\n";
131  return;
132  }
133 
134  //create histogram matrix with pointers to our histograms in question
135  // 5x3x3 tensor, 1st index is the stage 2nd index are variables
136  // (Et, Eta, Phi), 3rd index the different histograms
137  // (numerator - n-1 stage, denominator - n stage)
138  TH1F* histo_tensor[5][3][3];
139 
140  //now check size of our stages and variables to avoid segfaults!
141  if (objStage.size() > 5) {
142  std::cerr << "----> HLTEgammaPostProcess: Too many chain stages "
143  << "found in " << chain_path << " for relative efficiencies, bailing it!\n";
144  return;
145  }
146  if (varName.size() > 3) {
147  std::cerr << "----> HLTEgammaPostProcess: Too many variables "
148  << "used in " << chain_path << " for relative efficiencies, bailing out!\n";
149  return;
150  }
151 
152  //iterate through variables (start at 1, as there is no we can't
153  //calculate rejection efficiency w.r.t n-1 with n = 0 -> segfault!)
154  for (uint iVar = 0; iVar < varName.size(); ++iVar) {
155  //iterate through stages
156  for (uint iStg = 1; iStg < objStage.size(); ++iStg) {
157  //form names for all variables
158  TString preName = basePath + pathPre + objStage[iStg - 1] + varName[iVar];
159  TString rejName = basePath + pathPre + objStage[iStg] + varName[iVar];
160  TString effName = basePath + pathRej + objStage[iStg] + varName[iVar];
161  //check histogram existence
162  if (!CheckHistogram(f, rejName.Data())) {
163  std::cerr << "----> HLTEgammaPostProcess: Histogram "
164  << rejName << " does not exist in file "
165  << f->GetName() << " - skipping it!\n";
166  return;
167  }
168  if (!CheckHistogram(f, preName.Data())) {
169  std::cerr << "----> HLTEgammaPostProcess: Histogram "
170  << preName << " does not exist in file "
171  << f->GetName() << " - skipping it!\n";
172  return;
173  }
174  if (!CheckHistogram(f, effName.Data())) {
175  std::cerr << "----> HLTEgammaPostProcess: Histogram "
176  << effName << " does not exist in file "
177  << f->GetName() << " - skipping it!\n";
178  return;
179  }
180 
181  //debug outs
182  //std::cout << "---->HLTEgammaPostProcess: Taking " << rejName << " and divide by "
183  // << preName << " to get " << effName << std::endl;
184 
185  //now get our histograms
186  histo_tensor[iStg][iVar][0] = (TH1F*) (f->Get(rejName.Data()));
187  histo_tensor[iStg][iVar][1] = (TH1F*) (f->Get(preName.Data()));
188  histo_tensor[iStg][iVar][2] = (TH1F*) (f->Get(effName.Data()));
189 
190  //hop into rejection path
191  TString writePath = basePath + pathRej;
192  f->cd(writePath.Data());
193 
194  //create rejection efficiency histograms by division
195  histo_tensor[iStg][iVar][2]->Divide(histo_tensor[iStg][iVar][0], histo_tensor[iStg][iVar][1],
196  1.0, 1.0, "B");
197  histo_tensor[iStg][iVar][2]->Scale(100.);
198  if (histo_tensor[iStg][iVar][2]->Write("", TObject::kOverwrite) == 0) std::cerr
199  << "---->HLTEgammaPostProcess: Relative efficiency histogram "
200  << effName << " not written! Histograms will be buggy!\n";
201  }
202  }
203 
204  //save results now
205  f->Write();
206  }

◆ HLTEgammaPostProcess()

void dqutils::MonitoringFile::HLTEgammaPostProcess ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

Definition at line 29 of file MonitoringFile_HLTEgammaPostProcess.cxx.

29  {
30  // std::cout << "--> HLTEgammaPostProcess: Begin HLT Egamma post-processing" << std::endl;
31 
32  // ----- getting file -----
33 
34  //open root file
35  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
36 
37  //check files are loaded.
38  if (f == 0 || !f->IsOpen()) {
39  std::cerr << "--> HLTEgammaPostProcess: Input file not opened" << std::endl;
40  delete f;
41  return;
42  }
43 
44  //zombie files?
45  if (f->IsZombie()) {
46  std::cerr << "--> HLTEgammaPostProcess: Input file " << inFilename << " cannot be opened. " << std::endl;
47  delete f;
48  return;
49  }
50 
51  //check file size is not too small.
52  if (f->GetSize() < 1000.) {
53  std::cerr << "--> HLTEgammaPostProcess: Input file empty" << std::endl;
54  f->Close();
55  delete f;
56  return;
57  }
58 
59  //build iterator
60  TIter next_run(f->GetListOfKeys());
61  TKey* key_run(0);
62 
63  //loop over keys in root directory
64  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
65  TObject* obj_run = key_run->ReadObj();
66  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
67 
68  //check we have a valid pointer
69  if (tdir_run == 0) {
70  delete obj_run;
71  continue;
72  }
73 
74  //check name
75  std::string runDirName(tdir_run->GetName());
76  //std::cout<<"Run_directory: "<<runDirName<<std::endl;
77 
78  // check run directory
79  //(comment this out for local testing with the TrigEgammaMonitoring recipe)
80  if (runDirName.find("run") == std::string::npos) {
81  delete obj_run;
82  continue;
83  }
84 
85  // ----- find egamma monitoring directory (EgammaSigTE) ------
86  TString egammamonDirName = runDirName + "/HLT/EgammaSigTE";
87  TDirectory* egammamonDir(0);
88  if (!(egammamonDir = f->GetDirectory(egammamonDirName))) {
89  std::cout << "--> HLTEgammaPostProcess: directory " << egammamonDirName << " not found." << std::endl;
90  delete obj_run;
91  return;
92  }
93 
94  // ----- get handles for offline egamma object directories -----
95  TString offgammaDirName = egammamonDirName + "/OfflinePhoton";
96  TString offeleDirName = egammamonDirName + "/OfflineElectron";
97  TDirectory* offgammaDir(0);
98  TDirectory* offeleDir(0);
99  if (!(offgammaDir = f->GetDirectory(offgammaDirName))) {
100  std::cout << "--> HLTEgammaPostProcess: offline directory " << offgammaDirName << " not found, will abort.\n";
101  delete obj_run;
102  return;
103  }
104  if (!(offeleDir = f->GetDirectory(offeleDirName))) {
105  std::cout << "--> HLTEgammaPostProcess: offline directory " << offeleDirName << " not found, will abort.\n";
106  delete obj_run;
107  return;
108  }
109 
110  // ----- list the histograms for offline efficiencies -----
111  // word of warning: hardcoded maximum of 3 in the efficiency functions
112  // if you add stages, increase the size of histo_matrix
113  // or histo_tensor respectively!
114  // note: offline effs use "egEt", "egEta" etc., this is hardcoded in the
115  // variable name formation in the offl. eff function.
116  // finally: use std::vector<TString> varname = {"Et", "Eta", "Phi"}
117  // if we're ever going to use C++11 around this place...
118 
119  std::vector<TString> varName;
120  varName.push_back("Et");
121  varName.push_back("Eta");
122  varName.push_back("Phi");
123 
124  // ----- chain stages for relative effs -----
125  // word of warning: hardcoded maximum of 5 in the efficiency functions
126  // if you add stages, increase the size of histo_matrix
127  // or histo_tensor respectively!
128  // finally: use std::vector<TString> phoStage = {"L1", "L2Calo", "EFCalo"}
129  // and std::vector<TString> phoStage = {"L1", "L2Calo", "L2ID", "EFCalo", "EFID"}
130  // if we're ever going to use C++11 around this place...
131 
132  //photons
133  std::vector<TString> phoStage;
134  phoStage.push_back("L1");
135  phoStage.push_back("L2Calo");
136  phoStage.push_back("EFCalo");
137 
138  //electrons
139  std::vector<TString> eleStage;
140  eleStage.push_back("L1");
141  eleStage.push_back("L2Calo");
142  eleStage.push_back("L2ID");
143  eleStage.push_back("EFCalo");
144  eleStage.push_back("EFID");
145 
146  // ----- loop over directories (i.e. trigger chains) ------
147  TIter next_trig(egammamonDir->GetListOfKeys());
148  TKey* key_trig(0);
149  while ((key_trig = dynamic_cast<TKey*>(next_trig())) != 0) {
150  //store chain specific info (and resets them)
151  bool photon_chain(false);
152  bool electron_chain(false);
153  TObject* obj_trig = key_trig->ReadObj();
154  TDirectory* dir_trig = dynamic_cast<TDirectory*>(obj_trig);
155 
156  //check we have a valid pointer
157  if (dir_trig == 0) {
158  delete obj_trig;
159  continue;
160  }
161 
162  //get name of the current trigger chain
163  TString trigger_name = dir_trig->GetName();
164 
165  //bow out of offline containers here (we don't monitor them, they're for bootstrapping)
166  if (trigger_name.Contains("Offline")) {
167  delete obj_trig;
168  continue;
169  }
170 
171  //detect photon/electron chains (checks chain name, skips unrecognised chains)
172  if (trigger_name.BeginsWith("g") || trigger_name.BeginsWith("2g")) photon_chain = true;
173  else if (trigger_name.BeginsWith("e") || trigger_name.BeginsWith("2e")) electron_chain = true;
174  else {
175  std::cout << "--> HLTEgammaPostProcess: Non-electron/photon chain detected, will be skipped!\n";
176  delete obj_trig;
177  continue;
178  }
179 
180  //call photon post processing routine (no track directories, only Calo)
181  if (photon_chain) {
182  //std::cout<<"--> HLTEgammaPostProcess: calling photon functions for "<<egammamonDirName<<" and trigger
183  // item="<<dir_trig->GetName()<<" in directory: "<<getPath(dir_trig)<<endl;
184 
185  //calling boostrap efficiency calcs
186  HLTEgammaEfficiencyOff(f, dir_trig, offgammaDir, "L1/MatchedOffPho/", "L1/EffPho/", varName);
187  HLTEgammaEfficiencyOff(f, dir_trig, offgammaDir, "L2Calo/MatchedOffPho/", "L2Calo/EffPho/", varName);
188  HLTEgammaEfficiencyOff(f, dir_trig, offgammaDir, "EFCalo/MatchedOffPho/", "EFCalo/EffPho/", varName);
189  HLTEgammaEfficiencyOff(f, dir_trig, offgammaDir, "EFeg/MatchedOffPho/", "EFeg/EffPho/", varName);
190 
191  //calling relative efficiency calcs
192  HLTEgammaEfficiencyRel(f, dir_trig, "PreRejection/", "Rejection/", phoStage, varName);
193  }
194 
195  //call electron post processing (the full thing)
196  if (electron_chain) {
197  //std::cout<<"--> HLTEgammaPostProcess: calling electron functions for "<<egammamonDirName<<" and trigger
198  // item="<<dir_trig->GetName()<<" in directory: "<<getPath(dir_trig)<<endl;
199 
200  //calling bootstrap efficiency calcs
201  HLTEgammaEfficiencyOff(f, dir_trig, offeleDir, "L1/MatchedOffEle/", "L1/EffEle/", varName);
202  HLTEgammaEfficiencyOff(f, dir_trig, offeleDir, "L2Calo/MatchedOffEle/", "L2Calo/EffEle/", varName);
203  HLTEgammaEfficiencyOff(f, dir_trig, offeleDir, "L2ID/MatchedOffEle/", "L2ID/EffEle/", varName);
204  HLTEgammaEfficiencyOff(f, dir_trig, offeleDir, "EFCalo/MatchedOffEle/", "EFCalo/EffEle/", varName);
205  HLTEgammaEfficiencyOff(f, dir_trig, offeleDir, "EFID/MatchedOffEle/", "EFID/EffEle/", varName);
206  HLTEgammaEfficiencyOff(f, dir_trig, offeleDir, "EFeg/MatchedOffEle/", "EFeg/EffEle/", varName);
207 
208  //calling relative efficiency calcs
209  HLTEgammaEfficiencyRel(f, dir_trig, "PreRejection/", "Rejection/", eleStage, varName);
210  }
211  }
212  }
213 
214  //clean up after ourselves...
215  f->Close();
216  delete f;
217  //std::cout << "--> HLTEgammaPostProcess: finished HLT Egamma post-processing"<<std::endl;
218  }

◆ HLTJetCalcEfficiencyAndRate()

void dqutils::MonitoringFile::HLTJetCalcEfficiencyAndRate ( TFile *  f,
TString &  run_dir 
)
static

Definition at line 36 of file MonitoringFile_HLTJetCalcEfficiencyAndRate.cxx.

36  {
37  bool dbgLevel = false;
38 
39  if (dbgLevel) std::cout << "--> HLTJetCalcEfficiencyAndRate: Calculate jet trigger efficiency and rate" << std::endl;
40 
41  f->cd("/");
42  TIter next_run(f->GetListOfKeys());
43  TKey* key_run(0);
44  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
45  if (!key_run->IsFolder()) continue;
46  run_dir = key_run->GetName();
47  if (!run_dir.Contains("run")) {
48  continue;
49  }
50 
51 
52  std::string run_dir2 = run_dir.Data();
53  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
54  //run_number=run_number;
55 
56 
57  TString jetmon_dir = run_dir + "/HLT/JetMon";
58 
59  //===HLTJet efficiency histograms
60  TString akt4topo_dir = jetmon_dir + "/AntiKt4TopoJets/TrigEff";
61  //TString akt6topo_dir = jetmon_dir + "/AntiKt6TopoJets/TrigEff";
62 
63  TDirectory* dir(0);
64 
65  if (!(dir = f->GetDirectory(akt4topo_dir))) {
66  std::cerr << "--> HLTJetCalcEfficiencyAndRate: directory " << akt4topo_dir << " not found." << std::endl;
67  return;
68  }
69 
70  TH1F* hnum(0);
71  TH1F* hden(0);
72 
73 
74  //==Efficiency
75  std::vector<TString> effobs;
76  effobs.push_back("_Eff_vs_pt");
77  effobs.push_back("_Eff_vs_eta");
78  effobs.push_back("_Eff_vs_phi");
79 
80  std::vector<TString> TrigItems;
81 
82  // EF_fj30(_a4_EFFS) <-- L2_fj25 <-- L1_FJ10
83  // EF_j30(_a4_EFFS) <-- L2_j25 <-- L1_J10
84  // EF_j240(_a4_EFFS) <-- L2_j95 <-- L1_J75
85 
86  TrigItems.push_back("EF_fj30");
87  TrigItems.push_back("EF_j30");
88  TrigItems.push_back("EF_j240");
89  //TrigItems.push_back("EF_fj50");
90  //TrigItems.push_back("EF_fj75");
91 
92  //TrigItems.push_back("EF_j50");
93  //TrigItems.push_back("EF_j75");
94  //TrigItems.push_back("EF_j95");
95 
96  TrigItems.push_back("L1_FJ10");
97  TrigItems.push_back("L1_J10");
98  TrigItems.push_back("L1_J75");
99  //TrigItems.push_back("L1_FJ55");
100  //TrigItems.push_back("L1_FJ95");
101 
102  //TrigItems.push_back("L1_J30");
103  //TrigItems.push_back("L1_J55");
104  //TrigItems.push_back("L1_J75");
105 
106  //TrigItems.push_back("L2_fj45");
107  //TrigItems.push_back("L2_fj70");
108 
109  TrigItems.push_back("L2_fj25");
110  TrigItems.push_back("L2_j25");
111  TrigItems.push_back("L2_j95");
112  //TrigItems.push_back("L2_j30");
113  //TrigItems.push_back("L2_j45");
114  //TrigItems.push_back("L2_j70");
115  //TrigItems.push_back("L2_j90");
116 
117  TString snum, sden, hnumname;
118  for (std::vector<TString>::iterator itT = TrigItems.begin(); itT != TrigItems.end(); ++itT) {
119  for (std::vector<TString>::iterator itO = effobs.begin(); itO != effobs.end(); ++itO) {
120  hnumname = (*itT) + (*itO) + "_num";
121  snum = akt4topo_dir + "/" + hnumname;
122  sden = akt4topo_dir + "/" + (*itT) + (*itO) + "_den";
123 
124  if (!f->Get(snum)) {
125  if (dbgLevel) std::cerr << "--> HLTJetPostProcess: no such histogram " << snum << std::endl;
126  }
127  if (!f->Get(sden)) {
128  if (dbgLevel) std::cerr << "--> HLTJetPostProcess: no such histogram " << sden << std::endl;
129  }
130 
131  if (f->Get(snum) && f->Get(sden)) {
132  hnum = dynamic_cast<TH1F*>(f->Get(snum));
133  hnum->Sumw2();
134  hden = dynamic_cast<TH1F*>(f->Get(sden));
135  hden->Sumw2();
136 
137  Int_t nbins_num = hnum->GetNbinsX();
138  Int_t nbins_den = hden->GetNbinsX();
139  if (nbins_num != nbins_den) {
140  if (dbgLevel) std::cerr << "--> HLTJetPostProcess: cannot divide histogram " << hnum->GetName()
141  << " by " << hden->GetName() << ". Different number of bins." << std::endl;
142  }
143 
144  // divide num, den with binomial errors
145  // note: replacing the numerator by quotient
146  hnum->Divide(hnum, hden, 1., 1., "B");
147 
148  dir->cd();
149  hnum->Write("", TObject::kOverwrite);
150  }
151  } // for effobs
152  } // for TrigItems
153 
154  /*
155  if( !(dir = f->GetDirectory(akt6topo_dir)) ) {
156  std::cerr << "--> HLTJetCalcEfficiencyAndRate: directory " << akt6topo_dir << " not found." << std::endl;
157  return;
158  }
159 
160  for( std::vector<TString>::iterator itT = TrigItems.begin(); itT != TrigItems.end(); ++itT ) {
161  for( std::vector<TString>::iterator itO = effobs.begin(); itO != effobs.end(); ++itO ) {
162  hnumname = (*itT) + (*itO) + "_num";
163  snum = akt6topo_dir + "/" + hnumname;
164  sden = akt6topo_dir + "/" + (*itT) + (*itO) + "_den";
165 
166  if( ! f->Get(snum) ){std::cerr <<"--> HLTJetPostProcess: no such histogram "<< snum << std::endl; }
167  if( ! f->Get(sden) ){std::cerr <<"--> HLTJetPostProcess: no such histogram "<< sden << std::endl; }
168 
169  if( f->Get(snum) && f->Get(sden) ){
170  hnum = dynamic_cast<TH1F*>( f->Get(snum) );
171  hnum->Sumw2();
172  hden = dynamic_cast<TH1F*>( f->Get(sden) );
173  hden->Sumw2();
174 
175  Int_t nbins_num = hnum->GetNbinsX();
176  Int_t nbins_den = hden->GetNbinsX();
177  if(nbins_num != nbins_den) {
178  std::cerr <<"--> HLTJetPostProcess: cannot divide histogram "<< hnum->GetName()
179  << " by " << hden->GetName() << ". Different number of bins." << std::endl;
180  }
181  // note: replacing the numerator by quotient
182  hnum->Divide(hnum, hden, 1., 1., "B");
183  dir->cd();
184  hnum->Write("",TObject::kOverwrite);
185  }
186  } // for effobs
187  } // for TrigItems
188  */
189  }//while
190  }//MonitoringFile::HLTJetCalcEfficiencyAndRate

◆ HLTJetPostProcess()

void dqutils::MonitoringFile::HLTJetPostProcess ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 39 of file MonitoringFile_HLTJetPostProcess.cxx.

39  {
40  bool dbgLevel = false;
41 
42  if (dbgLevel) std::cout << "--> HLTJetPostProcess: Begin HLTJet post-processing" << std::endl;
43 
44  //open root file
45  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
46 
47  //check files are loaded.
48 
49  if (f == 0 || !f->IsOpen()) {
50  std::cerr << "--> HLTJetPostProcess: Input file not opened" << std::endl;
51  return;
52  }
53 
54  if (f->IsZombie()) {
55  std::cerr << "--> HLTJetPostProcess: Input file " << inFilename << " cannot be opened. " << std::endl;
56  return;
57  }
58 
59  //check file size is not too small.
60  if (f->GetSize() < 1000.) {
61  std::cerr << "--> HLTJetPostProcess: Input file empty" << std::endl;
62  f->Close();
63  return;
64  }
65 
66  //start postprocessing
67  TString run_dir;
69  //close root file
70  f->Close();
71  delete f;
72 
73  if (dbgLevel) std::cout << "--> HLTJetPostProcess: End HLTJet post-processing " << std::endl;
74 
75  return;
76  }

◆ HLTMETAveragePhivsEtaMaps()

void dqutils::MonitoringFile::HLTMETAveragePhivsEtaMaps ( TFile *  f,
TString &  run_dir 
)
static

Definition at line 38 of file MonitoringFile_HLTMETAveragePhivsEtaMaps.cxx.

38  {
39  bool dbgLevel = false;
40 
41  if (dbgLevel) std::cout << "--> HLTMETAveragePhivsEtaMaps: <Quantity(eta,phi)> = Quantity(eta,phi)/N(eta,phi) " << std::endl;
42 
43  f->cd("/");
44  TIter next_run(f->GetListOfKeys());
45  TKey* key_run(0);
46  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
47  if (!key_run->IsFolder()) continue;
48  run_dir = key_run->GetName();
49  if (!run_dir.Contains("run")) {
50  continue;
51  }
52 
53 
54  std::string run_dir2 = run_dir.Data();
55 
56  // all merged root files have the structure "rootfile.root:/run_NNNNNNN"
57  // use that to extract run number
58  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
59  //run_number=run_number;
60 
61  // begin HLTMET
62  // note 1: prefix all dirs and hists with '/'
63  // note 2: missing dir => return
64  // note 3: missing hist => continue
65  TString hlt_top = run_dir + "/HLT"; // toplevel
66  TString met_efdir = "/EFMissingET_Fex"; // EF dir
67 
68  std::vector<TString> met_fexs, hist_numr;
69 
70  // expect the following fex dirs
71  met_fexs.push_back("/METMon");
72  //met_fexs.push_back("/METMon_FEB");
73  //met_fexs.push_back("/METMon_allCells");
74 
75  // check if fex dirs are in hlt
76  for (std::vector<TString>::iterator it = met_fexs.begin(); it != met_fexs.end(); ++it) {
77  TString theHistDir = hlt_top + *it;
78  TDirectory* dir = f->GetDirectory(theHistDir);
79  if (!dir) {
80  std::cerr << "--> HLTMETAveragePhivsEtaMaps: directory " << theHistDir << " not found" << std::endl;
81  return;
82  }
83  // expect the EF dir inside each fex dir
84  theHistDir += met_efdir;
85  dir = f->GetDirectory(theHistDir);
86  if (!dir) {
87  std::cerr << "--> HLTMETAveragePhivsEtaMaps: directory " << theHistDir << " not found" << std::endl;
88  return;
89  }
90  }
91 
92  // MEt, SumEt, SumE of components (numerator)
93  // compSumEt_lin_EtaPhi_00 etc..
94  hist_numr.push_back("/compEt_lin_");
95  hist_numr.push_back("/compSumEt_lin_");
96  hist_numr.push_back("/compSumE_lin_"); // need to plot SumE on linear scale (todo)
97 
98  // components N (denominator)
99  TString hist_denr = "/compN_";
100 
101  // type (eta,phi map)
102  TString hist_suffix = "EtaPhi_"; // phi vs. eta map
103 
104  // each component a 2d hist. get all components
105  unsigned int comp_num = 25; // 25 components
106 
107  // we have all dirs, get the component histograms
108  for (std::vector<TString>::iterator itFex = met_fexs.begin(); itFex != met_fexs.end(); ++itFex) {
109  for (std::vector<TString>::iterator itNum = hist_numr.begin(); itNum != hist_numr.end(); ++itNum) {
110  for (unsigned int icomp = 0; icomp < comp_num; icomp++) {
111  TH2F* hnum(0), *hden(0);
112 
113  // prepend histogram name with path and append with suffix [_00 .., _24 for each component]
114  TString thePath = hlt_top + (*itFex) + met_efdir;
115  TString numHist = (*itNum) + hist_suffix + TString(Form("%02u", icomp));
116  TString denHist = hist_denr + hist_suffix + TString(Form("%02u", icomp));
117  TString numPath = thePath + numHist;
118  TString denPath = thePath + denHist;
119 
120  // test if histograms are present
121  if (!f->Get(numPath)) {
122  if (dbgLevel) std::cerr << "--> HLTMETAveragePhivsEtaMaps: no histogram " << numPath << std::endl;
123  continue;
124  }
125  if (!f->Get(denPath)) {
126  if (dbgLevel) std::cerr << "--> HLTMETAveragePhivsEtaMaps: no histogram " << denPath << std::endl;
127  continue;
128  }
129 
130  // get histograms
131  hnum = (TH2F*) (f->Get(numPath));
132  hden = (TH2F*) (f->Get(denPath));
133 
134  // get directory of histograms
135  TDirectory* dir = f->GetDirectory(thePath);
136 
137  // these are disabled, because we have to worry about updating metadata
138  // clone numerator histogram in the same directory; prepend with "avg_"
139  // use numerator to do the job
140  //TString avgHist = TString("avg_") + (*itNum) + hist_suffix + TString(Form("%02u",icomp));
141  //havg = (TH2F *) (hnum->Clone(avgHist));
142  //havg->SetDirectory(dir);
143 
144  // divide num by den to get average quantity.
145  hnum->Divide(hnum, hden);
146 
147  // fix histogram titles
148  TString title = hnum->GetTitle();
149  title.ReplaceAll(": ", ": #LT");
150  title.ReplaceAll("(#eta", "#GT(#eta");
151  hnum->SetTitle(title);
152 
153  //title = hden->GetTitle();
155  //title.ReplaceAll(" #phi VS #eta",": N(#eta, #phi)");
156  //hden->SetTitle(title);
157 
158  //std::cout << numHist << " div " << denHist << std::endl;
159  //std::cout << hnum->GetZaxis()->GetTitle() << "\t";
160  //std::cout << hden->GetZaxis()->GetTitle() << std::endl;
161  //std::cout << hnum->GetTitle() << "\t";
162  //std::cout << hden->GetTitle() << std::endl;
163  //std::cout << "-------------------------------------------------------------" << std::endl;
164  //getchar();
165  // cd() into that directory and save the avg histogram in file
166  dir->cd();
167  hnum->Write("", TObject::kOverwrite);
168  } // done looping over components
169  } // done looping over quantities
170  } // done looping over directories
171  } // end while loop over all keys
172  } // end method MonitoringFile::HLTMETAveragePhivsEtaMaps

◆ HLTMETDQFlagSummary()

void dqutils::MonitoringFile::HLTMETDQFlagSummary ( TFile *  f,
TString &  run_dir 
)
static

Definition at line 42 of file MonitoringFile_HLTMETDQFlagSummary.cxx.

42  {
43  bool dbgLevel = false;
44 
45  if (dbgLevel) std::cout << "--> HLTMETDQFlagSummary: Updating histograms in HLT/METMon*/DQPlots " << std::endl;
46 
47  f->cd("/");
48  TIter next_run(f->GetListOfKeys());
49  TKey* key_run(0);
50  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
51  if (!key_run->IsFolder()) continue;
52  run_dir = key_run->GetName();
53  if (!run_dir.Contains("run")) {
54  continue;
55  }
56 
57  TDirectory* tdir_run = dynamic_cast<TDirectory*>(key_run);
58 
59  std::string run_dir2 = run_dir.Data();
60 
61  // all merged root files have the structure "rootfile.root:/run_NNNNNNN"
62  // use that to extract run number
63  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
64  //run_number=run_number;
65 
66  // begin HLTMET
67  // note 1: prefix all dirs and hists with '/'
68  // note 2: missing dir => return
69  // note 3: missing hist => continue
70  TString hlt_top = run_dir + "/HLT"; // toplevel
71  TString met_efdir = "/EFMissingET_Fex"; // EF dir
72  TString met_l2dir = "/L2MissingET_Fex"; // L2 dir
73  TString dqflag_dir = "/DQFlags"; // DQ flags dir
74 
75  std::vector<TString> met_fexs, met_l2hists, met_efhists;
76  // expect the following fex dirs
77  met_fexs.push_back("/METMon");
78  //met_fexs.push_back("/METMon_FEB");
79  //met_fexs.push_back("/METMon_allCells");
80 
81  // expect the following histograms
82  met_l2hists.push_back("/L2_MET_status");
83  met_l2hists.push_back("/L2_MEx_log");
84  met_l2hists.push_back("/L2_MEy_log");
85  met_l2hists.push_back("/L2_MET_log");
86  met_l2hists.push_back("/L2_SumEt_log");
87 
88  met_efhists.push_back("/EF_MET_status");
89  met_efhists.push_back("/EF_MET_lin");
90  met_efhists.push_back("/EF_MET_lin1");
91  met_efhists.push_back("/EF_SumEt_lin");
92  met_efhists.push_back("/EF_MET_phi");
93  met_efhists.push_back("/EF_MET_phi1");
94  met_efhists.push_back("/EF_MEx_log");
95  met_efhists.push_back("/EF_MEy_log");
96  met_efhists.push_back("/compN_compSumEt_lin");
97  met_efhists.push_back("/compN_EF_MET_status");
98 
99  std::vector<TString> lbnDirs;
100  TString lbn_dqhist = "/trmet_lbn_flag";
101  size_t lbn_range = HLTMETGetDQLBNRange(tdir_run, lbnDirs);
102 
103  //std::cout << "lbn_range = " << lbn_range << std::endl;
104 
105  // Get EF/L2 status histograms for default Fex
106  for (std::vector<TString>::iterator itFex = met_fexs.begin(); itFex != met_fexs.end(); ++itFex) {
107  TString theL2Path = hlt_top + (*itFex) + met_l2dir;
108  TString theEFPath = hlt_top + (*itFex) + met_efdir;
109  TString theDQPath = hlt_top + (*itFex) + dqflag_dir;
110 
111  TDirectory* dirl2 = f->GetDirectory(theL2Path);
112  if (!dirl2) {
113  std::cerr << "--> HLTMETDQFlagSummary: directory " << theL2Path << " not found" << std::endl;
114  return;
115  }
116  TDirectory* diref = f->GetDirectory(theEFPath);
117  if (!diref) {
118  std::cerr << "--> HLTMETDQFlagSummary: directory " << theEFPath << " not found" << std::endl;
119  return;
120  }
121  TDirectory* dirdq = f->GetDirectory(theDQPath);
122  if (!dirdq) {
123  std::cerr << "--> HLTMETDQFlagSummary: directory " << theDQPath << " not found" << std::endl;
124  return;
125  }
126  // loop over L2 hists and copy to DQFlags
127  for (std::vector<TString>::iterator itHist = met_l2hists.begin(); itHist != met_l2hists.end(); ++itHist) {
128  TString histL2 = (theL2Path + *itHist);
129  TString histL2C = (theDQPath + *itHist);
130  TH1* hl2(0), *hl2c(0);
131  if (!f->Get(histL2)) {
132  if (dbgLevel) std::cerr << "--> HLTMETDQFlagSummary: no histogram " << histL2 << std::endl;
133  continue;
134  }
135  if (!f->Get(histL2C)) {
136  if (dbgLevel) std::cerr << "--> HLTMETDQFlagSummary: no histogram " << histL2C << std::endl;
137  continue;
138  }
139  hl2 = (TH1*) (f->Get(histL2));
140  // check if MET_status histogram is emtpy
141  bool save_status_hist = false;
142  if (*itHist == "/L2_MET_status") {
143  if (hl2->GetMaximum() < 1.e-3) {
144  save_status_hist = true;
145  for (int ibin = 1; ibin <= hl2->GetNbinsX(); ibin++) {
146  hl2->SetBinContent(ibin, 0.05);
147  }
148  }
149  }
150  hl2c = (TH1*) (f->Get(histL2C));
151  hl2c->Reset();
152  hl2c->Add(hl2);
153  //hl2c->Sumw2();
154  //std::cout << "--> HLTMETDQFlagSummary: added histograms " << histL2 << "\t and " << histL2C << std::endl;
155  dirdq->cd();
156  hl2c->Write("", TObject::kOverwrite);
157  if (save_status_hist) {
158  if (f->cd(theL2Path)) hl2->Write("", TObject::kOverwrite);
159  }
160  } // end loop over l2 hists
161 
162  // loop over EF hists and copy to DQFlags
163  for (std::vector<TString>::iterator itHist = met_efhists.begin(); itHist != met_efhists.end(); ++itHist) {
164  TString histEF = (theEFPath + *itHist);
165  TString histEFC = (theDQPath + *itHist);
166  TH1* hef(0), *hefc(0);
167  if (!f->Get(histEF)) {
168  if (dbgLevel) std::cerr << "--> HLTMETDQFlagSummary: no histogram " << histEF << std::endl;
169  continue;
170  }
171  if (!f->Get(histEFC)) {
172  if (dbgLevel) std::cerr << "--> HLTMETDQFlagSummary: no histogram " << histEFC << std::endl;
173  continue;
174  }
175  hef = (TH1*) (f->Get(histEF));
176  bool save_status_hist = false;
177  if (*itHist == "/EF_MET_status") {
178  if (hef->GetMaximum() < 1.e-3) {
179  save_status_hist = true;
180  for (int ibin = 1; ibin <= hef->GetNbinsX(); ibin++) {
181  hef->SetBinContent(ibin, 0.05);
182  }
183  }
184  }
185  hefc = (TH1*) (f->Get(histEFC));
186  hefc->Reset();
187  hefc->Add(hef);
188  //hefc->Sumw2();
189  dirdq->cd();
190  if (save_status_hist) {
191  if (f->cd(theEFPath)) hef->Write("", TObject::kOverwrite);
192  }
193  hefc->Write("", TObject::kOverwrite);
194  } // end loop over ef hists
195 
196  // resize lbn based histogram
197  if (lbn_range > 0) {
198  TString histLBN = theDQPath + lbn_dqhist;
199  TH1* hlb(0);
200  if (!f->Get(histLBN)) {
201  if (dbgLevel) std::cerr << "--> HLTMETDQFlagSummary: no histogram " << histLBN << std::endl;
202  continue;
203  }
204  hlb = (TH1*) (f->Get(histLBN));
205  unsigned int nbinx = (unsigned int) hlb->GetNbinsX(), nbiny = (unsigned int) hlb->GetNbinsY(), k = 1;
206  if (nbinx != nbiny) continue;
207 
208  if (lbn_range < nbinx) {
209  hlb->GetXaxis()->SetRangeUser(0, Double_t(lbn_range));
210  hlb->GetYaxis()->SetRangeUser(0, Double_t(lbn_range));
211  }
212  TH1I* hlbstat(0);
213  for (std::vector<TString>::iterator it = lbnDirs.begin(); it != lbnDirs.end(); ++it, ++k) {
214  if (k > nbinx) continue;
215  TString histLBstat = run_dir + TString("/") + *it + TString("/HLT") + (*itFex) + "/lbnstatus/EF_MET_status";
216  if (!f->Get(histLBstat)) {
217  if (dbgLevel) std::cerr << "--> HLTMETDQFlagSummary: no histogram " << histLBstat << std::endl;
218  continue;
219  }
220  hlbstat = (TH1I*) (f->Get(histLBstat));
221  int flag = HLTMETGetStatusPerBin(hlbstat, 17, 29, 32, 32);
222  //std::cout << "--> HLTMETDQFlagSummary: " << *it << "\t: flag = " << flag << std::endl;
223  TString label = *it;
224  label.ReplaceAll("lowStat_", "");
225  hlb->GetXaxis()->SetBinLabel(k, label.Data());
226  hlb->GetYaxis()->SetBinLabel(k, label.Data());
227  hlb->SetBinContent(k, k, flag);
228  } // end for
229  hlb->Write("", TObject::kOverwrite);
230  } else {
231  std::cerr << "--> HLTMETDQFlagSummary: lowStat_* directories: found none " << std::endl;
232  }
233  } // end loop over fexs
234  } // end while loop over all keys
235  } // end method MonitoringFile::HLTMETDQFlagSummary

◆ HLTMETGetDQLBNRange()

size_t dqutils::MonitoringFile::HLTMETGetDQLBNRange ( TDirectory *&  run_dir,
std::vector< TString > &  lbnDirs 
)
static

Definition at line 240 of file MonitoringFile_HLTMETDQFlagSummary.cxx.

240  {
241  if (!run_dir) return 0;
242 
243  lbnDirs.clear();
244 
245  bool dbgLevel = false;
246  if (dbgLevel) std::cout << "--> HLTMETGetDQLBNRange: lowStat_* directories: ";
247  run_dir->cd();
248 
249  TIter next_lbn(run_dir->GetListOfKeys());
250  TKey* key_lbn(0);
251  TString lbn_dir = "";
252  // loop over all objects
253  while ((key_lbn = dynamic_cast<TKey*> (next_lbn())) != 0) {
254  if (!key_lbn->IsFolder()) continue;
255  lbn_dir = key_lbn->GetName();
256  if (!lbn_dir.Contains("lowStat_")) {
257  continue;
258  }
259  lbnDirs.push_back(lbn_dir);
260  //std::cout << "dir = " << lbn_dir << "\tuuid = " << uuid.AsString() << "\ttime = " << dtme.GetTime() <<
261  // std::endl;
262  }
263  unsigned int nLBNDirs = lbnDirs.size();
264  if (dbgLevel) std::cout << "found " << nLBNDirs << std::endl;
265  return nLBNDirs;
266  } // end method MonitoringFile::HLTMETGetDQLBNRange

◆ HLTMETGetStatusPerBin()

int dqutils::MonitoringFile::HLTMETGetStatusPerBin ( TH1I *&  hist,
int  ymin,
int  ymax,
int  rmin,
int  rmax 
)
static

Definition at line 271 of file MonitoringFile_HLTMETDQFlagSummary.cxx.

271  {
272  if (!hist) return 0;
273 
274  TString hname = hist->GetName();
275  int flag = 10; // 1 == GREEN, 2 == YELLOW, 3 == RED
276  float epsilon = 1.e-3;
277  int nbins = (int) hist->GetNbinsX();
278  yellmin = (yellmin > 0 && yellmin <= nbins) ? yellmin : 1;
279  yellmax = (yellmax > 0 && yellmax <= nbins) ? yellmax : nbins;
280  redmin = (redmin > 0 && redmin <= nbins) ? redmin : 1;
281  redmax = (redmax > 0 && redmax <= nbins) ? redmax : nbins;
282  for (int k = 1; k <= nbins; k++) {
283  float theVal = hist->GetBinContent(k);
284  // at least one bin > 0
285  if (theVal > epsilon) {
286  if (k >= yellmin && k <= yellmax) flag = 100;
287  if (k >= redmin && k <= redmax) flag = 1000;
288  } // end if
289  } // end for
290  return flag;
291  } // end method MonitoringFile::HLTMETGetStatusPerBin

◆ HLTMETPostProcess()

void dqutils::MonitoringFile::HLTMETPostProcess ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 39 of file MonitoringFile_HLTMETPostProcess.cxx.

39  {
40  bool dbgLevel = false;
41 
42  if (dbgLevel) std::cout << "--> HLTMETPostProcess: Begin HLTMET post-processing" << std::endl;
43 
44  //open root file
45  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
46 
47  //check files are loaded.
48 
49  if (f == 0 || !f->IsOpen()) {
50  std::cerr << "--> HLTMETPostProcess: Input file not opened" << std::endl;
51  return;
52  }
53 
54  if (f->IsZombie()) {
55  std::cerr << "--> HLTMETPostProcess: Input file " << inFilename << " cannot be opened. " << std::endl;
56  return;
57  }
58 
59  //check file size is not too small.
60  if (f->GetSize() < 1000.) {
61  std::cerr << "--> HLTMETPostProcess: Input file empty" << std::endl;
62  f->Close();
63  return;
64  }
65 
66  //start postprocessing
67  TString run_dir;
68  HLTMETAveragePhivsEtaMaps(f, run_dir);
69  HLTMETDQFlagSummary(f, run_dir);
70  //close root file
71  f->Close();
72  delete f;
73 
74  if (dbgLevel) std::cout << "--> HLTMETPostProcess: End HLTMET post-processing " << std::endl;
75 
76  return;
77  }

◆ HLTMinBiasMonGetTargetHistos()

void dqutils::MonitoringFile::HLTMinBiasMonGetTargetHistos ( TDirectory *  source,
std::vector< std::pair< TString, TString > > &  targetNames 
)
static

Definition at line 143 of file MonitoringFile_HLTMinBiasMonPostProcess.cxx.

145  {
146  TKey* key;
147  TIter nextkey(source->GetListOfKeys());
148 
149  while ((key = (TKey*) nextkey())) {
150  const char* classname = key->GetClassName();
151  TClass* cl = gROOT->GetClass(classname);
152  if (!cl) continue;
153  if (cl->InheritsFrom(TDirectory::Class())) {
154  TString kname = key->GetName();
155 
156  source->cd(key->GetName());
157  TDirectory* nextdir = gDirectory;
158  HLTMinBiasMonGetTargetHistos(nextdir, targetNames);
159  }
160  if (cl->InheritsFrom(TH1F::Class())) {
161  TString cRatio = TString(key->GetName());
162  if (cRatio == "Efficiency" ||
163  cRatio == "Purity" ||
164  cRatio == "EfficienciesTrigger" ||
165  cRatio == "EfficiencyTracks" ||
166  cRatio ==
167  "TriggerPurities") targetNames.push_back(std::pair<TString, TString>(TString(gDirectory->GetPath()),
168  TString(key->GetName())));
169  }
170  }
171  }

◆ HLTMinBiasMonPostProcess()

void dqutils::MonitoringFile::HLTMinBiasMonPostProcess ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 28 of file MonitoringFile_HLTMinBiasMonPostProcess.cxx.

28  {
29  // std::cout << "--> HLTMinBiasMonPostProcess: Begin HLT MinBias post-processing" << std::endl;
30 
31  //open root file
32  TFile* f = TFile::Open(inFilename.c_str(), "READ");
33 
34  //check files are loaded.
35  if (f == 0 || !f->IsOpen()) {
36  // std::cerr << "--> HLTMinBiasMonPostProcess: Input file not opened" << std::endl;
37  delete f;
38  return;
39  }
40 
41  //zombie files?
42  if (f->IsZombie()) {
43  // std::cerr << "--> HLTMinBiasMonPostProcess: Input file " << inFilename << " cannot be opened. " <<
44  // std::endl;
45  delete f;
46  return;
47  }
48 
49  //check file size is not too small.
50  if (f->GetSize() < 1000.) {
51  // std::cerr << "--> HLTMinBiasMonPostProcess: Input file empty" << std::endl;
52  f->Close();
53  delete f;
54  return;
55  }
56  //build iterator
57  TIter next_run(f->GetListOfKeys());
58  TKey* key_run(0);
59  TString minbiasmonDirName;
60 
61  std::vector< std::pair<TString, TString> >* v_targetNames = new std::vector< std::pair<TString, TString> >(0);
62 
63 
64  //loop over keys in root directory
65  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
66  TObject* obj_run = key_run->ReadObj();
67  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
68 
69  //check we have a valid pointer
70  if (tdir_run == 0) {
71  delete obj_run;
72  continue;
73  }
74 
75  //check name
76  std::string runDirName(tdir_run->GetName());
77  // std::cout<<"Run_directory: "<<runDirName<<std::endl;
78 
79  if (runDirName.find("run") == std::string::npos) {
80  delete obj_run;
81  continue;
82  }
83 
84  //find MinBiasMon dir
85  minbiasmonDirName = runDirName + "/HLT/MinBiasMon";
86  TDirectory* minbiasmonDir(0);
87  if (!(minbiasmonDir = f->GetDirectory(minbiasmonDirName))) {
88 // std::cerr << "--> HLTMinBiasMonPostProcess: directory " << minbiasmonDirName << " not found." << std::endl;
89  delete v_targetNames;
90  return;
91  }
93  }
94 
95  f->Close();
96  f = 0;
97 
98  f = TFile::Open(inFilename.c_str(), "UPDATE");
99 
100  const TString repPath = TString(f->GetPath());
101 
102  //first update global efficiency
103  f->cd(minbiasmonDirName);
104 
105  TH1F* h_triggEffic = dynamic_cast<TH1F*>(gDirectory->Get("TriggerEfficiencies"));
106  TH1F* h_triggEfficPass = dynamic_cast<TH1F*>(gDirectory->Get("TriggerEfficienciesPassed"));
107  TH1F* h_triggEfficAll = dynamic_cast<TH1F*>(gDirectory->Get("TriggerEfficienciesAll"));
108  if (!h_triggEffic or !h_triggEfficPass or !h_triggEfficAll) {
109  std::cerr << "Dynamic cast failed in MonitoringFile::HLTMinBiasMonPostProcess\n";
110  f->Close();
111  delete f;
112  delete v_targetNames;
113  return;
114  }
115 
116  h_triggEffic->Divide(h_triggEfficPass, h_triggEfficAll, 1., 1., "B");
117  h_triggEffic->GetYaxis()->SetRangeUser(0., 1.2);
118  h_triggEffic->Write("", TObject::kOverwrite);
119 
120  for (uint k = 0; k < v_targetNames->size(); k++) {
121  v_targetNames->at(k).first.ReplaceAll(repPath, "");
122 
123  f->cd(v_targetNames->at(k).first);
124 
125  TH1F* h_target = dynamic_cast<TH1F*>(gDirectory->Get(v_targetNames->at(k).second));
126  TH1F* h_num = dynamic_cast<TH1F*>(gDirectory->Get(v_targetNames->at(k).second + "Passed"));
127  TH1F* h_den = dynamic_cast<TH1F*>(gDirectory->Get(v_targetNames->at(k).second + "All"));
128 
129  if (h_target != 0 && h_num != 0 && h_den != 0) {
130  h_target->Divide(h_num, h_den, 1., 1., "B");
131  h_target->GetYaxis()->SetRangeUser(0., 1.2);
132  h_target->Write("", TObject::kOverwrite);
133  }
134  }
135  v_targetNames->clear();
136  delete v_targetNames;
137  v_targetNames = 0;
138 
139  f->Close();
140  delete f;
141  }

◆ HLTMuonCheckHistogram()

bool dqutils::MonitoringFile::HLTMuonCheckHistogram ( TFile *  f,
TString &  hname 
)
static

Definition at line 58 of file MonitoringFile_HLTMuonPostProcess.cxx.

58  {
59  if (!(f->Get(hname))) {
60  if (fpdbg) {
61  std::cerr << "HLTMuon PostProcessing: no such histogram!! : " << hname << std::endl;
62  gDirectory->pwd();
63  gDirectory->ls();
64  }
65  return false;
66  }
67  return true;
68  }//MonitoringFile::HLTMuonCheckHistogram

◆ HLTMuonHDiv()

void dqutils::MonitoringFile::HLTMuonHDiv ( PostProcessorFileWrapper mf,
TString  sdir,
TString  snum,
TString  sden,
TString  seff,
TString  seffg 
)
static

Definition at line 1722 of file MonitoringFile_HLTMuonHistogramDivision.cxx.

1723  {
1724  auto getHPointer ATLAS_THREAD_SAFE = [&mf] ATLAS_NOT_THREAD_SAFE(const TString &hname)->TH1F * {
1725  TH1F* pH {};
1726  mf.get(hname, pH);
1727  if (!pH and fdbg) {
1728  std::cerr << "HLTMuon PostProcessing: no such histogram!! " << hname << std::endl;
1729  }
1730  return pH;
1731  };
1732  TH1F* h1tmpf(0);
1733  TH1F* h1num(0);
1734  TH1F* h1den(0);
1735  TGraphAsymmErrors* h1tmpfg = new TGraphAsymmErrors();
1736 
1737  ;
1738  TString stmp = seff + seffg;
1739 
1740  h1num = getHPointer(sdir + "NumDenom/" + snum);
1741  if (!h1num) return;
1742 
1743  h1den = getHPointer(sdir + "NumDenom/" + sden);
1744  if (!h1den) return;
1745 
1746  TDirectory* dir = mf.GetDirectory(sdir);
1747 
1748  h1tmpf = (TH1F*) h1den->Clone();
1749  h1tmpf->SetName(stmp);
1750  h1tmpf->SetTitle(stmp);
1751  h1tmpf->GetYaxis()->SetTitle("Efficiency");
1752  h1tmpf->Reset();
1753  h1tmpf->Divide(h1num, h1den, 1., 1., "B");
1754  h1tmpf->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1755  h1tmpf->SetMinimum(0.0);
1756  h1tmpfg->SetMaximum(1.05);
1757  h1tmpf->SetName(stmp);
1758  dir->cd();
1759  h1tmpf->Write();
1760  h1tmpfg->SetMarkerStyle(20);
1761  h1tmpfg->SetMinimum(0.0);
1762  h1tmpfg->SetMaximum(1.05);
1763  h1tmpfg->BayesDivide(h1num, h1den);
1764  h1tmpfg->GetYaxis()->SetTitle("Efficiency");
1765  h1tmpfg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1766  dir->cd();
1767  h1tmpfg->SetName(stmp);
1768  h1tmpfg->Write();
1769  delete h1tmpfg;
1770  }

◆ HLTMuonHistogramDivision()

void dqutils::MonitoringFile::HLTMuonHistogramDivision ( const std::string &  inFilename,
TString &  run_dir 
)
static

Definition at line 43 of file MonitoringFile_HLTMuonHistogramDivision.cxx.

43  {
44  bool HI_pp_key = false;//true::HI false::pp
45 
46  if (fdbg) std::cout << " Start to Divide HLTMuon Histograms for Efficiency and Rate Ratio" << std::endl;
47  PostProcessorFileWrapper mf(inFilename, "HLT Histogram Division");
48  if (!mf.IsOpen()) {
49  std::cerr << "HLTMuonPostProcess(): "
50  << "Input file not opened \n";
51  return;
52  }
53  if (mf.GetSize() < 1000.) {
54  std::cerr << "HLTMuonPostProcess(): "
55  << "Input file empty \n";
56  return;
57  }
58  // get run directory name
59  //Seemingly unnecessary lines are necessary
60  TIter nextcd0(gDirectory->GetListOfKeys());
61  TKey* key0 = (TKey*) nextcd0();
62  if (key0 == 0) return;
63 
64  TDirectory* dir0 = dynamic_cast<TDirectory*> (key0->ReadObj());
65  if (dir0 == 0) return;
66 
67  dir0->cd();
68 
69  auto getHPointer ATLAS_THREAD_SAFE = [&mf] ATLAS_NOT_THREAD_SAFE(const TString &hname)->TH1F * {
70  TH1F* pH {};
71  mf.get(hname, pH);
72  if (!pH and fdbg) {
73  std::cerr << "HLTMuon PostProcessing: no such histogram!! " << hname << std::endl;
74  }
75  return pH;
76  };
77  auto getHistogramPair = [&getHPointer] (const TString &numeratorName, const TString &denominatorName)->std::pair<TH1F *, TH1F *> {
78  TH1F* pH2 {};
79  TH1F* pH1 = getHPointer(numeratorName);
80  if (pH1){
81  pH2 = getHPointer(denominatorName);
82  }
83  return std::pair{pH1, pH2};
84  };
85 
86  auto getH2Pointer ATLAS_THREAD_SAFE = [&mf] ATLAS_NOT_THREAD_SAFE(const TString &hname)->TH2F * {
87  TH2F* pH {};
88  mf.get(hname, pH);
89  if (!pH and fdbg) {
90  std::cerr << "HLTMuon PostProcessing: no such histogram!! " << hname << std::endl;
91  }
92  return pH;
93  };
94 
95 
97 
98  // 110728: removing the iteration of searching run directory according to the new MDT code
99  // 150621: reenable ...
100  TIter next_run(mf.GetListOfKeys());
101  TKey* key_run(0);
102  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) { //== the while commented out at the end
103  if (!key_run->IsFolder()) continue;
104  run_dir = key_run->GetName();
105  if (!run_dir.Contains("run")) {
106  continue;
107  }
108  break;
109  }
110  if (!run_dir.Contains("run")) {
111  std::cerr << "HLTMuon: unable to find run directory ..." << std::endl;
112  return;
113  }
114  {
115  if (fdbg) {
116  std::cout << "HLTMuon: run directory is " << run_dir << std::endl;
117  }
118  std::string run_dir2 = run_dir.Data();
119 
120  //===HLTMuon
121 
122  TH1F* hHI_PP_Flag(0);
123  TString hi_pp_flag = run_dir + "/HLT/MuonMon/Common/HI_PP_Flag";
124  hHI_PP_Flag = getHPointer(hi_pp_flag);
125  if (hHI_PP_Flag) {
126  HI_pp_key = hHI_PP_Flag->GetBinContent(1) > 0;
127  }
128 
129  TString muon_dir = run_dir + "/HLT/MuonMon/";
130 
131  TString cm_dir = muon_dir + "Common/";
132  TString mf_dir = muon_dir + "L2MuonSA/";
133  TString mc_dir = muon_dir + "muComb/";
134  TString mi_dir = muon_dir + "muIso/";
135  TString tm_dir = muon_dir + "TileMu/";
136  TString ef_dir = muon_dir + "MuonEF/";
137  // YY added
138  TString ztp_dir = muon_dir + "MuZTP/";
139 
140  TString eff_dir = muon_dir + "Efficiency/";
141  TString nd_dir = muon_dir + "Efficiency/NumDenom/";
142  TString rate_dir = muon_dir + "Rate/";
143  TString rr_dir = muon_dir + "Rate/Ratio/";
144 
145  TString seff;
146  TString seffg; // YY added
147  TString snum;
148  TString sden;
149  TString stmp;
150  TString stmpg;
151 
152  TH1F* h1tmp(0);
153  TH1F* h1eff(0);
154  TH1F* h1sumeff(0); // new YY
155  TH1F* h1effsum(nullptr);
156  TGraphAsymmErrors* h1tmpg;
157 
158  //==Efficiency
159  // L2MuonSA efficiency
160  TDirectory* dir = mf.GetDirectory(eff_dir);
161  if (!dir) {
162  std::cerr << "HLTMuonHistogramDivision: directory " << eff_dir << " not found" << std::endl;
163  return;
164  }
165 
166  std::vector<TString> effnames;
167  effnames.push_back("L2MuonSA_effi_toRecMuonCB_pt");
168  effnames.push_back("L2MuonSA_effi_toRecMuonCB_pt_barrel");
169  effnames.push_back("L2MuonSA_effi_toRecMuonCB_pt_endcap");
170  effnames.push_back("L2MuonSA_effi_toRecMuonCB_eta");
171  effnames.push_back("L2MuonSA_effi_toRecMuonCB_phi");
172 
173  for (std::vector<TString>::iterator it = effnames.begin(); it != effnames.end(); ++it) {
174  seff = eff_dir + (*it);
175  snum = mf_dir + (*it) + "_numer";
176  sden = mf_dir + (*it) + "_denom";
177  stmp = (*it);
178  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
179  if (not h1num) continue;
180  //
181  h1tmp = (TH1F*) h1den->Clone();
182  h1tmp->SetName(stmp);
183  std::string stcar = h1tmp->GetTitle();
184  stcar.replace(stcar.end() - 5, stcar.end(), "");
185  h1tmp->SetTitle(stcar.c_str());
186  h1tmp->GetYaxis()->SetTitle("Efficiency");
187  h1tmp->Reset();
188  h1tmp->Divide(h1num, h1den, 1., 1., "B");
189  dir->cd();
190  h1tmp->Write();
191  }//effnames
192  mf.Write();
193 
194  // muComb efficiency
195  effnames.clear();
196  effnames.push_back("muComb_effi_toOffl_pt");
197  effnames.push_back("muComb_effi_toOffl_pt_barrel");
198  effnames.push_back("muComb_effi_toOffl_pt_endcap");
199  effnames.push_back("muComb_effi_toOffl_eta");
200  effnames.push_back("muComb_effi_toOffl_phi");
201 
202  for (std::vector<TString>::iterator it = effnames.begin(); it != effnames.end(); ++it) {
203  seff = eff_dir + (*it);
204  snum = mc_dir + (*it) + "_numer";
205  sden = mc_dir + (*it) + "_denom";
206  stmp = (*it);
207  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
208  if (!h1num) continue;
209  //
210  h1tmp = (TH1F*) h1den->Clone();
211  h1tmp->SetName(stmp);
212  std::string stcar = h1tmp->GetTitle();
213  stcar.replace(stcar.end() - 5, stcar.end(), "");
214  h1tmp->SetTitle(stcar.c_str());
215  h1tmp->GetYaxis()->SetTitle("Efficiency");
216  h1tmp->Reset();
217  h1tmp->Divide(h1num, h1den, 1., 1., "B");
218  dir->cd();
219  h1tmp->Write();
220  }//effnames
221  mf.Write();
222 
223  // muIso efficiency
224  effnames.clear();
225  effnames.push_back("muIso_effi_toOffl_pt");
226 
227  for (std::vector<TString>::iterator it = effnames.begin(); it != effnames.end(); ++it) {
228  seff = eff_dir + (*it);
229  snum = mi_dir + (*it) + "_numer";
230  sden = mi_dir + (*it) + "_denom";
231  stmp = (*it);
232  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
233  if (!h1num) continue;
234  //
235  h1tmp = (TH1F*) h1den->Clone();
236  h1tmp->SetName(stmp);
237  std::string stcar = h1tmp->GetTitle();
238  stcar.replace(stcar.end() - 5, stcar.end(), "");
239  h1tmp->SetTitle(stcar.c_str());
240  h1tmp->GetYaxis()->SetTitle("Efficiency");
241  h1tmp->Reset();
242  h1tmp->Divide(h1num, h1den, 1., 1., "B");
243  dir->cd();
244  h1tmp->Write();
245  }//effnames
246  mf.Write();
247 
248  // TileMu efficiency
249  effnames.clear();
250  std::vector<TString> numnames;
251  std::vector<TString> dennames;
252  effnames.push_back("TileMu_RecCBMuon_EffEta");
253  numnames.push_back("Rec_Eta_Num");
254  dennames.push_back("Rec_Eta");
255  effnames.push_back("TileMu_RecCBMuon_EffPhi");
256  numnames.push_back("Rec_Phi_Num");
257  dennames.push_back("Rec_Phi");
258  effnames.push_back("TileTrackMu_RecCBMuon_EffEta");
259  numnames.push_back("TileTrackMu_Eta");
260  dennames.push_back("Rec_Eta");
261  effnames.push_back("TileTrackMu_RecCBMuon_EffPhi");
262  numnames.push_back("TileTrackMu_Phi");
263  dennames.push_back("Rec_Phi");
264  effnames.push_back("TileTrackMu_RecCBMuon_EffPt");
265  numnames.push_back("TileTrackMu_Pt");
266  dennames.push_back("Rec_Pt");
267 
268  for (unsigned int i = 0; i < effnames.size(); i++) {
269  seff = eff_dir + effnames.at(i);
270  snum = tm_dir + numnames.at(i);
271  sden = tm_dir + dennames.at(i);
272  stmp = effnames.at(i);
273  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
274  if (!h1num) continue;
275 
276  h1tmp = (TH1F*) h1den->Clone();
277  h1tmp->SetName(stmp);
278  std::istringstream iss(stmp.Data());
279  std::string token;
280  int ili = 0;
281  while (std::getline(iss, token, '_')) {
282  stmp = token + "Feature wrt Offline)";
283  ili++;
284  if (ili > 0) break;
285  }
286 
287  std::string stcar = h1tmp->GetTitle();
288  if (stcar.find("Pt") != std::string::npos) {
289  stmp = "Efficiency on p_{T} (" + stmp;
290  h1tmp->GetXaxis()->SetTitle("p_{T}");
291  }
292  if (stcar.find("Eta") != std::string::npos) stmp = "Efficiency on #eta (" + stmp;
293  if (stcar.find("Phi") != std::string::npos) stmp = "Efficiency on #phi (" + stmp;
294  h1tmp->SetTitle(stmp);
295  h1tmp->GetYaxis()->SetTitle("Efficiency");
296  h1tmp->Reset();
297  h1tmp->Divide(h1num, h1den, 1., 1., "B");
298  dir->cd();
299  h1tmp->Write();
300  }//effnames
301  mf.Write();
302 
303  // MuonEF efficiency
304  effnames.clear();
305  numnames.clear();
306  dennames.clear();
307  effnames.push_back("EFMS_effi_toOffl_pt");
308  effnames.push_back("EFMS_effi_toOffl_eta");
309  effnames.push_back("EFMS_effi_toOffl_phi");
310  effnames.push_back("EFSA_effi_toOffl_pt");
311  effnames.push_back("EFCB_effi_toOffl_pt");
312 
313  for (std::vector<TString>::iterator it = effnames.begin(); it != effnames.end(); ++it) {
314  seff = eff_dir + (*it);
315  snum = ef_dir + (*it) + "_numer";
316  sden = ef_dir + (*it) + "_denom";
317  stmp = (*it);
318  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
319  if (!h1num) continue;
320 
321  h1tmp = (TH1F*) h1den->Clone();
322  h1tmp->SetName(stmp);
323  std::string stcar = h1tmp->GetTitle();
324  stcar.replace(stcar.end() - 5, stcar.end(), "");
325  h1tmp->SetTitle(stcar.c_str());
326  h1tmp->GetYaxis()->SetTitle("Efficiency");
327  h1tmp->Reset();
328  h1tmp->Divide(h1num, h1den, 1., 1., "B");
329  dir->cd();
330  h1tmp->Write();
331  }//effnames
332  mf.Write();
333 
334  //==Turn on
335  std::vector<TString> chainsMSonly;
336  std::vector<TString> chainsStandard;
337  std::vector<TString> chainsMG;
338  std::vector<TString> chainsMI;
339  std::vector<TString> chainsGeneric;
340  std::vector<TString> chainsEFiso;
341  std::vector<TString> chainsEFFS;
342 
343  // Generic (EFsuper etc.)
344 
345  chainsGeneric.push_back("muChain1"); // MAM
346  chainsGeneric.push_back("muChain2"); // MAM
347 
348  // Generic (Isolated muons)
349  chainsEFiso.push_back("muChainEFiso1"); // MAM
350  chainsEFiso.push_back("muChainEFiso2"); // MAM
351 
352  // MSonly
353 
354  chainsMSonly.push_back("muChainMSonly1"); // MAM
355  chainsMSonly.push_back("muChainMSonly2"); // MAM
356 
357  // EFFS triggers (L. Yuan)
358  chainsEFFS.push_back("muChainEFFS"); // MAM
359 
360  enum indexINDEP {
361  INDORTH, INDEGAMMA, INDMET, INDJET, INDTAU, INDMBIAS
362  };
363  TString trigger[INDMBIAS + 1];
364 
365  trigger[INDORTH] = "Orthog";//EGamma + Tau + Jet + MET
366  trigger[INDEGAMMA] = "EGamma";
367  trigger[INDMET] = "MET";
368  trigger[INDJET] = "Jet";
369 
370  int maxindep = 0; // YY 20.01.2012
371 
372  // YY added:
373  TString ESchainName = "_ES";
374 
375  TString bestr[2] = {
376  "_Barrel", "_Endcap"
377  };
378 
379  // made it as enum: 20.1.2012
380  std::string triggerES[7] = {
381  "_ESstd", "_EStag", "_ESid", "_ESindep", "_ESHIL1", "_ESHIid", "_ESHIindep"
382  };
383  enum indexES {
384  ESSTD, ESTAG, ESID, ESINDEP, ESHIL1, ESHIID, ESHIINDEP
385  };
386 
387  int maxESbr = ESINDEP;
388 
389  bool CB_mon_ESbr[ESHIINDEP + 1];
390  bool MS_mon_ESbr[ESHIINDEP + 1];
391 
392  CB_mon_ESbr[ESSTD] = 0;
393  CB_mon_ESbr[ESTAG] = 0;
394  CB_mon_ESbr[ESID] = 1;
395  CB_mon_ESbr[ESINDEP] = 0;
396  CB_mon_ESbr[ESHIL1] = 0;
397  CB_mon_ESbr[ESHIID] = 0;
398  CB_mon_ESbr[ESHIINDEP] = 0;
399 
400  MS_mon_ESbr[ESSTD] = 0;
401  MS_mon_ESbr[ESTAG] = 1;
402  MS_mon_ESbr[ESID] = 0;
403  MS_mon_ESbr[ESINDEP] = 0;
404  MS_mon_ESbr[ESHIL1] = 0;
405  MS_mon_ESbr[ESHIID] = 0;
406  MS_mon_ESbr[ESHIINDEP] = 0;
407 
408  std::vector<std::string> vectkwd;
409 
410  vectkwd.push_back(triggerES[ESTAG]);
411  vectkwd.push_back(triggerES[ESID]);
412  vectkwd.push_back("_Jet");
413  vectkwd.push_back("_all");
414 
415  TString hptName = "_hpt";
416  TString MSchainName = "_MSb";
417 
418  // YY: pt range.
419  int iSTDL;
420  int iSTDH;
421  if (HI_pp_key) {
422  iSTDL = 45; // 12 GeV
423  //iSTDL = 54; // 15 GeV
424  iSTDH = 75; // 25 GeV
425  } else {
426  iSTDL = 105; // 60 GeV
427  //iSTDL = 91; // 40 GeV
428  iSTDH = 120; // 100 GeV
429  //iSTDH = 120; // 100 GeV
430  }
431  int iMSL = 105; // 60 GeV
432  int iMSH = 120; // 100 GeV
433 
434  if (HI_pp_key) {
435  iMSL = 54;//15GeV
436  iMSH = 75;//25GeV
437  }
438  // YY added:
439  enum ieffAlgo {
440  iL2MuonSA = 0, // StdAlgo
441  iMuComb = 1, // StdAlgo
442  iEFCB = 2, // StdAlgo
443  iMuGirl = 3, // StdAlgo
444 
445  iEFSA = 1 // MSAlgo
446  };
447 
448  // Standard Chains
449  //TString alg[5] = {"_L2MuonSA", "_MuComb", "_MuonEFMS", "_MuonEFSA", "_MuonEFCB"};
450  //TString wrtalg[5] = {"_L1", "_L2MuonSA", "_MuComb", "_MuComb", "_MuComb"};
451 
452  // ******************************************************//
453  // start the code add by Yuan //
454  //TString FS_pre_trigger = "mu18it_tight";
455  TString FS_pre_trigger = "EFFSpre";
456  for (unsigned int i = 0; i < chainsEFFS.size(); i++) {
457  TString chainName = chainsEFFS.at(i);
458 
459  TString hists_str[9] = {
460  chainName + "_tagEFFSpre" + "_Turn_On_Curve_wrt_probe_MuidCB",
461  chainName + "_tagEFFSpre" + "_Turn_On_Curve_wrt_probe_MuidCB_Barrel",
462  chainName + "_tagEFFSpre" + "_Turn_On_Curve_wrt_probe_MuidCB_Endcap",
463  chainName + "_tagEFFSpre_mu0_15" + "_Turn_On_Curve_wrt_probe_MuidCB",
464  chainName + "_tagEFFSpre_mu15_20" + "_Turn_On_Curve_wrt_probe_MuidCB",
465  chainName + "_tagEFFSpre_mu20" + "_Turn_On_Curve_wrt_probe_MuidCB",
466  chainName + "_Turn_On_Curve_wrt_subleading_MuidCB",
467  FS_pre_trigger + "_dimuonTP" + "_Turn_On_Curve_wrt_probe_MuidCB",
468  FS_pre_trigger + "_dimuonTP" + "_Turn_On_Curve_wrt_L1_probe_MuidCB",
469  };
470 
471  bool for_mydebug = false;
472  auto getHPointerQuietly ATLAS_THREAD_SAFE =
473  [&mf, for_mydebug] ATLAS_NOT_THREAD_SAFE(const TString &hname)->TH1F * {
474  TH1F* pH {};
475  mf.get(hname, pH);
476  if (!pH and for_mydebug) {
477  std::cerr << "HLTMuon PostProcessing: no such histogram!! " << hname << std::endl;
478  }
479  return pH;
480  };
481  auto getHistogramPairQuietly = [&getHPointerQuietly] (const TString &numeratorName, const TString &denominatorName)->std::pair<TH1F *, TH1F *> {
482  TH1F* pH2 {};
483  TH1F* pH1 = getHPointerQuietly(numeratorName);
484  if (pH1){
485  pH2 = getHPointerQuietly(denominatorName);
486  }
487  return std::pair{pH1, pH2};
488  };
489 
490 
491  for (int iROI = 0; iROI < 9; iROI++) {
492  sden = nd_dir + hists_str[iROI] + "_Denominator";
493  snum = nd_dir + hists_str[iROI] + "_Numerator";
494  seff = eff_dir + hists_str[iROI];
495  seffg = seff + "_Fit";
496 
497  stmp = hists_str[iROI];
498  stmpg = hists_str[iROI] + "_Fit";
499  const auto & [h1num, h1den] = getHistogramPairQuietly(snum, sden);
500  if (!h1num) continue;
501 
502  h1tmp = (TH1F*) h1den->Clone();
503  h1tmp->SetName(stmp);
504  h1tmp->SetTitle(stmp);
505  h1tmp->GetYaxis()->SetTitle("Efficiency");
506  h1tmp->Reset();
507  h1tmp->Divide(h1num, h1den, 1., 1., "B");
508  dir->cd();
509  h1tmp->Write();
510  h1tmpg = new TGraphAsymmErrors();
511  h1tmpg->SetMarkerStyle(20);
512  h1tmpg->SetMinimum(0.0);
513  h1tmpg->SetMaximum(1.05);
514  h1tmpg->BayesDivide(h1num, h1den);
515  h1tmpg->GetYaxis()->SetTitle("Efficiency");
516  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
517  h1tmpg->SetName(stmpg);
518  h1tmpg->Write();
519  delete h1tmpg;
520  } // end the loop on individual turn-on curves
521 
522  TString L1_TP_str = FS_pre_trigger + "_dimuonTP_L1" + "_Turn_On_Curve_wrt_probe_MuidCB";
523  sden = nd_dir + FS_pre_trigger + "_dimuonTP" + "_Turn_On_Curve_wrt_probe_MuidCB" + "_Denominator";
524  snum = nd_dir + FS_pre_trigger + "_dimuonTP" + "_Turn_On_Curve_wrt_L1_probe_MuidCB" + "_Denominator";
525  seff = eff_dir + L1_TP_str;
526  seffg = seff + "_Fit";
527  stmp = L1_TP_str;
528  stmpg = L1_TP_str + "_Fit";
529  const auto & [h1num, h1den] = getHistogramPairQuietly(snum, sden);
530  if (!h1num) continue;
531 
532  h1tmp = (TH1F*) h1den->Clone();
533  h1tmp->SetName(stmp);
534  h1tmp->SetTitle(stmp);
535  h1tmp->GetYaxis()->SetTitle("Efficiency");
536  h1tmp->Reset();
537  h1tmp->Divide(h1num, h1den, 1., 1., "B");
538  dir->cd();
539  h1tmp->Write();
540  h1tmpg = new TGraphAsymmErrors();
541  h1tmpg->SetMarkerStyle(20);
542  h1tmpg->SetMinimum(0.0);
543  h1tmpg->SetMaximum(1.05);
544  h1tmpg->BayesDivide(h1num, h1den);
545  h1tmpg->GetYaxis()->SetTitle("Efficiency");
546  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
547  dir->cd();
548  h1tmpg->SetName(stmpg);
549  h1tmpg->Write();
550  delete h1tmpg;
551 
552  //**** summargy plot **********//
553 
554  TString histNumB = nd_dir + chainName + "_tagEFFSpre_Turn_On_Curve_wrt_probe_MuidCB_Barrel_Numerator";
555  TString histDenB = nd_dir + chainName + "_tagEFFSpre_Turn_On_Curve_wrt_probe_MuidCB_Barrel_Denominator";
556  TString histNumE = nd_dir + chainName + "_tagEFFSpre_Turn_On_Curve_wrt_probe_MuidCB_Endcap_Numerator";
557  TString histDenE = nd_dir + chainName + "_tagEFFSpre_Turn_On_Curve_wrt_probe_MuidCB_Endcap_Denominator";
558  TString histL1sum = eff_dir + chainName + "_EFplateau_wrtOffline";
559  const auto & [h1numb, h1denb] = getHistogramPairQuietly(histNumB, histDenB);
560  if (!h1numb) continue;
561 
562  const auto & [h1nume, h1dene] = getHistogramPairQuietly(histNumE, histDenE);
563  if (!h1nume) continue;
564 
565  TH1F* h1sumL = getHPointerQuietly(histL1sum);
566  if (!h1sumL) continue;
567  //
568  int iSTDL = 75;//25GeV
569  int iSTDH = 120;
570  if (HI_pp_key) {//HI run 4-25GeV
571  iSTDL = 17;
572  iSTDH = 75;
573  }
574  double sumeff {}, sumerr {};
575  double sumn = h1numb->Integral(iSTDL, iSTDH); // 60-100 GeV
576  double sumd = h1denb->Integral(iSTDL, iSTDH);
577  if (sumd != 0.) {
578  sumeff = (double) sumn / (double) sumd;
579  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
580  }
581 
582  h1sumL->SetBinContent(1, sumeff);
583  h1sumL->SetBinError(1, sumerr);
584 
585  sumn = h1nume->Integral(iSTDL, iSTDH);
586  sumd = h1dene->Integral(iSTDL, iSTDH);
587  if (sumd == 0.) {
588  sumeff = 0.;
589  sumerr = 0.;
590  } else {
591  sumeff = (double) sumn / (double) sumd;
592  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
593  }
594  h1sumL->GetYaxis()->SetTitle("Efficiency");
595  h1sumL->SetBinContent(2, sumeff);
596  h1sumL->SetBinError(2, sumerr);
597  h1sumL->SetMinimum(0.0);
598  h1sumL->SetMaximum(1.05);
599 
600  dir->cd();
601  h1sumL->Write("", TObject::kOverwrite);
602 
603  TString histNum_mu0_15 = nd_dir + chainName + "_tagEFFSpre_mu0_15_Turn_On_Curve_wrt_probe_MuidCB_Numerator";
604  TString histDen_mu0_15 = nd_dir + chainName + "_tagEFFSpre_mu0_15_Turn_On_Curve_wrt_probe_MuidCB_Denominator";
605  TString histNum_mu15_20 = nd_dir + chainName + "_tagEFFSpre_mu15_20_Turn_On_Curve_wrt_probe_MuidCB_Numerator";
606  TString histDen_mu15_20 = nd_dir + chainName + "_tagEFFSpre_mu15_20_Turn_On_Curve_wrt_probe_MuidCB_Denominator";
607  TString histNum_mu20 = nd_dir + chainName + "_tagEFFSpre_mu20_Turn_On_Curve_wrt_probe_MuidCB_Numerator";
608  TString histDen_mu20 = nd_dir + chainName + "_tagEFFSpre_mu20_Turn_On_Curve_wrt_probe_MuidCB_Denominator";
609  TString histEFsum_mu = eff_dir + chainName + "_EFplateau_wrtOffline_mu_dependence";
610 
611  TH1F* h1num_mu0_15 = getHPointerQuietly(histNum_mu0_15);
612  if (!h1num_mu0_15) continue;
613 
614  TH1F* h1num_mu15_20 = getHPointerQuietly(histNum_mu15_20);
615  if (!h1num_mu15_20) continue;
616 
617  TH1F* h1num_mu20 = getHPointerQuietly(histNum_mu20);
618  if (!h1num_mu20) continue;
619 
620  TH1F* h1den_mu0_15 = getHPointerQuietly(histDen_mu0_15);
621  if (!h1den_mu0_15) continue;
622 
623  TH1F* h1den_mu15_20 = getHPointerQuietly(histDen_mu15_20);
624  if (!h1den_mu15_20) continue;
625 
626  TH1F* h1den_mu20 = getHPointerQuietly(histDen_mu20);
627  if (!h1den_mu20) continue;
628 
629  TH1F* h1sum_mu = getHPointerQuietly(histEFsum_mu);
630  if (!h1sum_mu) continue;
631 
632  sumn = h1num_mu0_15->Integral(iSTDL, iSTDH); // 25-100 GeV
633  sumd = h1den_mu0_15->Integral(iSTDL, iSTDH);
634  if (sumd == 0.) {
635  sumeff = 0.;
636  sumerr = 0.;
637  } else {
638  sumeff = (double) sumn / (double) sumd;
639  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
640  }
641 
642  h1sum_mu->SetBinContent(1, sumeff);
643  h1sum_mu->SetBinError(1, sumerr);
644 
645  sumn = h1num_mu15_20->Integral(iSTDL, iSTDH);
646  sumd = h1den_mu15_20->Integral(iSTDL, iSTDH);
647  if (sumd == 0.) {
648  sumeff = 0.;
649  sumerr = 0.;
650  } else {
651  sumeff = (double) sumn / (double) sumd;
652  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
653  }
654  h1sum_mu->SetBinContent(2, sumeff);
655  h1sum_mu->SetBinError(2, sumerr);
656 
657  sumn = h1num_mu20->Integral(iSTDL, iSTDH);
658  sumd = h1den_mu20->Integral(iSTDL, iSTDH);
659  if (sumd == 0.) {
660  sumeff = 0.;
661  sumerr = 0.;
662  } else {
663  sumeff = (double) sumn / (double) sumd;
664  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
665  }
666  h1sum_mu->GetYaxis()->SetTitle("Efficiency");
667  h1sum_mu->SetBinContent(3, sumeff);
668  h1sum_mu->SetBinError(3, sumerr);
669  h1sum_mu->SetMaximum(1.05);
670  h1sum_mu->SetMinimum(0.0);
671  dir->cd();
672  h1sum_mu->Write("", TObject::kOverwrite);
673  mf.Write();
674  }
675  // end of the code add by Yuan //
676  // ******************************************************//
677  TString alg2[3] = {
678  "_L2MuonSA", "_MuonEFMS", "_MuonEFSA"
679  };
680  TString wrtalg2[3] = {
681  "_L1", "_L2MuonSA", "_L2MuonSA"
682  };
683 
684  // ******************************************************//
685  // ****************** MSonly Chains ********************//
686  // ******************************************************//
687  for (unsigned int i = 0; i < chainsMSonly.size(); i++) {
688  TString chainName = chainsMSonly.at(i);
689 
690  for (int trg = 0; trg < maxindep; trg++) {
691  sden = nd_dir + chainName + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered_Denominator";
692 
693  for (int alg = 0; alg < 3; alg++) {
694  snum = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered_Numerator";
695  seff = eff_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered";
696  seffg = seff + "_Fit"; // YY added 20.04.10
697  stmp = chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered";
698  stmpg = chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered" + "_Fit";
699  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
700  if (!h1num) continue;
701 
702  h1tmp = (TH1F*) h1den->Clone();
703  h1tmp->SetName(stmp);
704  h1tmp->SetTitle(stmp);
705  h1tmp->GetYaxis()->SetTitle("Efficiency");
706  h1tmp->Reset();
707  h1tmp->Divide(h1num, h1den, 1., 1., "B");
708  dir->cd();
709  h1tmp->Write();
710  h1tmpg = new TGraphAsymmErrors();
711  h1tmpg->SetName(stmpg);
712  h1tmpg->SetMarkerStyle(20);
713  h1tmpg->SetMinimum(0.0);
714  h1tmpg->SetMaximum(1.05);
715  h1tmpg->BayesDivide(h1num, h1den);
716  h1tmpg->GetYaxis()->SetTitle("Efficiency");
717  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
718  dir->cd();
719  h1tmpg->Write();
720  delete h1tmpg;
721 
722  // summary for jet trigger
723  if (0 == alg || 2 == alg) {
724  if (3 == trg) { // jet
725  double sumeff {}, sumerr {};
726  double sumn = h1num->Integral(iMSL, iMSH);
727  double sumd = h1den->Integral(iMSL, iMSH);
728  if (sumd != 0.) {
729  sumeff = (double) sumn / (double) sumd;
730  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
731  }
732  int iholx = -1;
733  if (0 == alg) {
734  iholx = static_cast<int>(iL2MuonSA);
735  } else if (2 == alg) {
736  iholx = static_cast<int>(iEFSA);
737  }
738 
739  if (iholx >= 0) {
740  TString s = eff_dir + chainName + "_highpt_effsummary_by" + vectkwd.at(2);
741  h1sumeff = getHPointer(s);
742  if (!h1sumeff) continue;
743 
744  h1sumeff->SetBinContent(iholx + 1, sumeff);
745  h1sumeff->SetBinError(iholx + 1, sumerr);
746  h1sumeff->GetYaxis()->SetTitleOffset(1.3);
747  h1sumeff->SetMinimum(0.0);
748  h1sumeff->SetMaximum(1.05);
749  // saving
750  dir->cd();
751  h1sumeff->Write("", TObject::kOverwrite);
752  }
753  }
754  }
755  }//alg
756  }//trg
757  mf.Write();
758 
759  for (int alg = 0; alg < 3; alg++) {
760  //wrt MuidSA
761  sden = nd_dir + chainName + "_Turn_On_Curve_wrt_MuidSA_Denominator";
762  snum = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_Numerator";
763  seff = eff_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA";
764  seffg = seff + "_Fit"; // YY added 20.04.10
765  stmp = chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA";
766  stmpg = chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
767  const auto & [pNum, pDen] = getHistogramPair(snum, sden);
768  if (!pNum) continue;
769 
770  h1tmp = (TH1F*) pDen->Clone();
771  h1tmp->SetName(stmp);
772  h1tmp->SetTitle(stmp);
773  h1tmp->GetYaxis()->SetTitle("Efficiency");
774  h1tmp->Reset();
775  h1tmp->Divide(pNum, pDen, 1., 1., "B");
776  dir->cd();
777  h1tmp->Write();
778  h1tmpg = new TGraphAsymmErrors();
779  h1tmpg->SetName(stmpg);
780  h1tmpg->SetMarkerStyle(20);
781  h1tmpg->SetMinimum(0.0);
782  h1tmpg->SetMaximum(1.05);
783  h1tmpg->BayesDivide(pNum, pDen);
784  h1tmpg->GetYaxis()->SetTitle("Efficiency");
785  h1tmpg->GetXaxis()->SetTitle(pDen->GetXaxis()->GetTitle());
786  dir->cd();
787  h1tmpg->Write();
788  delete h1tmpg;
789 
790  if (0 == alg || 2 == alg) { // no condition on ES bits = all events
791  double sumeff {}, sumerr {};
792  double sumn = pNum->Integral(iMSL, iMSH);
793  double sumd = pDen->Integral(iMSL, iMSH);
794  if (sumd != 0.) {
795  sumeff = (double) sumn / (double) sumd;
796  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
797  }
798  int iholx = -1;
799  if (0 == alg) {
800  iholx = static_cast<int>(iL2MuonSA);
801  } else if (2 == alg) {
802  iholx = static_cast<int>(iEFSA);
803  }
804 
805  if (iholx >= 0) {
806  TString s = eff_dir + chainName + "_highpt_effsummary_by" + vectkwd.at(3);
807  h1sumeff = getHPointer(s);
808  if (!h1sumeff) continue;
809  h1sumeff->GetYaxis()->SetTitleOffset(1.3);
810  h1sumeff->SetBinContent(iholx + 1, sumeff);
811  h1sumeff->SetBinError(iholx + 1, sumerr);
812  h1sumeff->SetMinimum(0.0);
813  h1sumeff->SetMaximum(1.05);
814  // saving
815  dir->cd();
816  h1sumeff->Write("", TObject::kOverwrite);
817  }
818  }
819  //wrt MuidSA
820 
821  // for ES ----------------------------------------------------------------
822  for (int ies = 0; ies <= maxESbr; ies++) {
823  if (!MS_mon_ESbr[ies]) continue;
824  // for ES, L1 ------------------------------------------------------------
825  if (0 == alg) {
826  sden = nd_dir + chainName + triggerES[ies] + "_Turn_On_Curve_wrt_MuidSA_Denominator";
827  snum = nd_dir + chainName + triggerES[ies] + "_L2MuonSA" + "_Turn_On_Curve_wrt" + "_L1" + "_Denominator";
828  seff = eff_dir + chainName + triggerES[ies] + "_L1" + "_Turn_On_Curve_wrt_MuidSA";
829  seffg = seff + "_Fit";
830  stmp = chainName + triggerES[alg] + "_L1" + "_Turn_On_Curve_wrt_MuidSA";
831  stmpg = chainName + triggerES[alg] + "_L1" + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
832  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
833  if (!h1num) continue;
834 
835  h1tmp = (TH1F*) h1den->Clone();
836  h1tmp->SetName(stmp);
837  h1tmp->SetTitle(stmp);
838  h1tmp->GetYaxis()->SetTitle("Efficiency");
839  h1tmp->Reset();
840  h1tmp->Divide(h1num, h1den, 1., 1., "B");
841  dir->cd();
842  h1tmp->Write();
843  h1tmpg = new TGraphAsymmErrors();
844  h1tmpg->SetName(stmpg);
845  h1tmpg->SetMarkerStyle(20);
846  h1tmpg->SetMinimum(0.0);
847  h1tmpg->SetMaximum(1.05);
848  h1tmpg->BayesDivide(h1num, h1den);
849  h1tmpg->GetYaxis()->SetTitle("Efficiency");
850  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
851  dir->cd();
852  h1tmpg->Write();
853  delete h1tmpg;
854 
855 
856  for (int be = 0; be < 2; be++) {
857  sden = nd_dir + chainName + triggerES[ies] + "_Turn_On_Curve_wrt_MuidSA" + bestr[be] + "_Denominator";
858  snum = nd_dir + chainName + triggerES[ies] + "_L2MuonSA" + "_Turn_On_Curve_wrt" + "_L1" + bestr[be] +
859  "_Denominator";
860  seff = eff_dir + chainName + triggerES[ies] + "_L1" + bestr[be] + "_Turn_On_Curve_wrt_MuidSA";
861  seffg = seff + "_Fit";
862  stmp = chainName + triggerES[ies] + "_L1" + bestr[be] + "_Turn_On_Curve_wrt_MuidSA";
863  stmpg = chainName + triggerES[ies] + "_L1" + bestr[be] + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
864  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
865  if (!h1num) continue;
866 
867  h1tmp = (TH1F*) h1den->Clone();
868  h1tmp->SetName(stmp);
869  h1tmp->SetTitle(stmp);
870  h1tmp->GetYaxis()->SetTitle("Efficiency");
871  h1tmp->Reset();
872  h1tmp->Divide(h1num, h1den, 1., 1., "B");
873  dir->cd();
874  h1tmp->Write();
875  h1tmpg = new TGraphAsymmErrors();
876  h1tmpg->SetName(stmpg);
877  h1tmpg->SetMarkerStyle(20);
878  h1tmpg->SetMinimum(0.0);
879  h1tmpg->SetMaximum(1.05);
880  h1tmpg->BayesDivide(h1num, h1den);
881  h1tmpg->GetYaxis()->SetTitle("Efficiency");
882  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
883  dir->cd();
884  h1tmpg->Write();
885  delete h1tmpg;
886  }
887  }
888 
889  // for ES, L1 end ------------------------------------------------------------
890  sden = nd_dir + chainName + triggerES[ies] + "_Turn_On_Curve_wrt_MuidSA_Denominator";
891  snum = nd_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_Numerator";
892  seff = eff_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA";
893  seffg = seff + "_Fit"; // YY added 20.04.10
894  stmp = chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA";
895  stmpg = chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
896  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
897  if (!h1num) continue;
898 
899  h1tmp = (TH1F*) h1den->Clone();
900  h1tmp->SetName(stmp);
901  h1tmp->SetTitle(stmp);
902  h1tmp->GetYaxis()->SetTitle("Efficiency");
903  h1tmp->Reset();
904  h1tmp->Divide(h1num, h1den, 1., 1., "B");
905  dir->cd();
906  h1tmp->Write();
907  h1tmpg = new TGraphAsymmErrors();
908  h1tmpg->SetName(stmpg);
909  h1tmpg->SetMarkerStyle(20);
910  h1tmpg->SetMinimum(0.0);
911  h1tmpg->SetMaximum(1.05);
912  h1tmpg->BayesDivide(h1num, h1den);
913  h1tmpg->GetYaxis()->SetTitle("Efficiency");
914  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
915  dir->cd();
916  h1tmpg->Write();
917  delete h1tmpg;
918 
919  if (0 == alg || 2 == alg) {
920  if (ESTAG == ies || ESINDEP == ies) {
921  double sumeff, sumerr;
922  double sumn = h1num->Integral(iMSL, iMSH);
923  double sumd = h1den->Integral(iMSL, iMSH);
924  if (sumd == 0.) {
925  sumeff = 0.;
926  sumerr = 0.;
927  } else {
928  sumeff = (double) sumn / (double) sumd;
929  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
930  }
931  int iholx = -1;
932  if (0 == alg) {
933  iholx = static_cast<int>(iL2MuonSA);
934  } else if (2 == alg) {
935  iholx = static_cast<int>(iEFSA);
936  }
937 
938  if (iholx >= 0) {
939  TString s = eff_dir + chainName + "_highpt_effsummary_by" + triggerES[ies];
940  h1sumeff = getHPointer(s);
941  if (!h1sumeff) continue;
942  h1sumeff->GetYaxis()->SetTitleOffset(1.3);
943  h1sumeff->SetBinContent(iholx + 1, sumeff);
944  h1sumeff->SetBinError(iholx + 1, sumerr);
945  h1sumeff->SetMinimum(0.0);
946  h1sumeff->SetMaximum(1.05);
947  // saving
948  dir->cd();
949  h1sumeff->Write("", TObject::kOverwrite);
950  }
951  }
952  }
953  }
954  // for ES: end ----------------------------------------------------------------
955 
956  if (0 == alg || 2 == alg) {
957  for (int be = 0; be < 2; be++) {
958  //wrt MuidSA
959  sden = nd_dir + chainName + "_Turn_On_Curve_wrt_MuidSA" + bestr[be] + "_Denominator";
960  snum = nd_dir + chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
961  seff = eff_dir + chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidSA";
962  seffg = seff + "_Fit"; // YY added 20.04.10
963  stmp = chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidSA";
964  stmpg = chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
965  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
966  if (!h1num) continue;
967 
968  h1tmp = (TH1F*) h1den->Clone();
969  h1tmp->SetName(stmp);
970  h1tmp->SetTitle(stmp);
971  h1tmp->GetYaxis()->SetTitle("Efficiency");
972  h1tmp->Reset();
973  h1tmp->Divide(h1num, h1den, 1., 1., "B");
974  dir->cd();
975  h1tmp->Write();
976  h1tmpg = new TGraphAsymmErrors();
977  h1tmpg->SetName(stmpg);
978  h1tmpg->SetMarkerStyle(20);
979  h1tmpg->SetMinimum(0.0);
980  h1tmpg->SetMaximum(1.05);
981  h1tmpg->BayesDivide(h1num, h1den);
982  h1tmpg->GetYaxis()->SetTitle("Efficiency");
983  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
984  dir->cd();
985  h1tmpg->Write();
986  delete h1tmpg;
987  }
988  }
989 
990  //wrt upstream
991  sden = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + "_Denominator";
992  snum = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_Numerator";
993  seff = eff_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg];
994  seffg = seff + "_Fit"; // YY added 20.04.10
995  stmp = chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg];
996  stmpg = chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + "_Fit";
997  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
998  if (!h1num) continue;
999 
1000  h1tmp = (TH1F*) h1den->Clone();
1001  h1tmp->SetName(stmp);
1002  h1tmp->SetTitle(stmp);
1003  h1tmp->GetYaxis()->SetTitle("Efficiency");
1004  h1tmp->Reset();
1005  h1tmp->Divide(h1num, h1den, 1., 1., "B");
1006  dir->cd();
1007  h1tmp->Write();
1008  h1tmpg = new TGraphAsymmErrors();
1009  h1tmpg->SetName(stmpg);
1010  h1tmpg->SetMarkerStyle(20);
1011  h1tmpg->SetMinimum(0.0);
1012  h1tmpg->SetMaximum(1.05);
1013  h1tmpg->BayesDivide(h1num, h1den);
1014  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1015  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1016  dir->cd();
1017  h1tmpg->Write();
1018  delete h1tmpg;
1019 
1020 
1021  //wrt upstream
1022  // for ES --------------------------------------------------------------------
1023  for (int ies = 0; ies <= maxESbr; ies++) {
1024  if (!MS_mon_ESbr[ies]) continue;
1025  sden = nd_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] +
1026  "_Denominator";
1027  snum = nd_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_Numerator";
1028  seff = eff_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg];
1029  seffg = seff + "_Fit"; // YY added 20.04.10
1030  stmp = chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg];
1031  stmpg = chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + "_Fit";
1032  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1033  if (!h1num) continue;
1034 
1035  h1tmp = (TH1F*) h1den->Clone();
1036  h1tmp->SetName(stmp);
1037  h1tmp->SetTitle(stmp);
1038  h1tmp->GetYaxis()->SetTitle("Efficiency");
1039  h1tmp->Reset();
1040  h1tmp->Divide(h1num, h1den, 1., 1., "B");
1041  dir->cd();
1042  h1tmp->Write();
1043  h1tmpg = new TGraphAsymmErrors();
1044  h1tmpg->SetName(stmpg);
1045  h1tmpg->SetMarkerStyle(20);
1046  h1tmpg->SetMinimum(0.0);
1047  h1tmpg->SetMaximum(1.05);
1048  h1tmpg->BayesDivide(h1num, h1den);
1049  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1050  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1051  dir->cd();
1052  h1tmpg->Write();
1053  delete h1tmpg;
1054  }
1055  // for ES: end --------------------------------------------------------------------
1056 
1057  if (0 == alg || 2 == alg) {
1058  for (int be = 0; be < 2; be++) {
1059  //wrt upstream
1060  sden = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + bestr[be] + "_Denominator";
1061  snum = nd_dir + chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1062  seff = eff_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + bestr[be];
1063  seffg = seff + "_Fit"; // YY added 20.04.10
1064  stmp = chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + bestr[be];
1065  stmpg = chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + bestr[be] + "_Fit";
1066  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1067  if (!h1num) continue;
1068 
1069  h1tmp = (TH1F*) h1den->Clone();
1070  h1tmp->SetName(stmp);
1071  h1tmp->SetTitle(stmp);
1072  h1tmp->GetYaxis()->SetTitle("Efficiency");
1073  h1tmp->Reset();
1074  h1tmp->Divide(h1num, h1den, 1., 1., "B");
1075  dir->cd();
1076  h1tmp->Write();
1077  h1tmpg = new TGraphAsymmErrors();
1078  h1tmpg->SetName(stmpg);
1079  h1tmpg->SetMarkerStyle(20);
1080  h1tmpg->SetMinimum(0.0);
1081  h1tmpg->SetMaximum(1.05);
1082  h1tmpg->BayesDivide(h1num, h1den);
1083  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1084  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1085  dir->cd();
1086  h1tmpg->Write();
1087  delete h1tmpg;
1088  }
1089  }
1090  }//alg
1091  mf.Write();
1092  }//i
1093 
1094  //==Rate
1095  dir = mf.GetDirectory(rr_dir);
1096  if (!dir) {
1097  if (fdbg) {
1098  std::cerr << "HLTMuonHistogramDivision: directory " << rr_dir << " not found" << std::endl;
1099  }
1100  return;
1101  }
1102 
1103  // EF rate / offline rate
1104  std::string type[3] = {
1105  "MS_", "SA_", "CB_"
1106  };
1107  std::string off[3] = {
1108  "Moore_MS_", "Moore_SA_", "Muid_"
1109  };
1110  std::string cut[2] = {
1111  "4", "10"
1112  };
1113 
1114  for (int itype = 0; itype < 3; itype++) {
1115  for (int icut = 0; icut < 2; icut++) {
1116  seff = rr_dir + "EF_" + type[itype] + "Over_" + off[itype] + cut[icut] + "GeV_Cut";
1117  snum = rate_dir + "Number_Of_EF_" + type[itype] + "Muons_" + cut[icut] + "GeV_Cut";
1118  sden = rate_dir + "Number_Of_" + off[itype] + "Muons_" + cut[icut] + "GeV_Cut";
1119  stmp = "EF_" + type[itype] + "Over_" + off[itype] + cut[icut] + "GeV_Cut";
1120  stmpg = "EF_" + type[itype] + "Over_" + off[itype] + cut[icut] + "GeV_Cut" + "_Fit";
1121  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1122  if (!h1num) continue;
1123 
1124  h1tmp = (TH1F*) h1den->Clone();
1125  h1tmp->SetName(stmp);
1126  h1tmp->SetTitle(stmp);
1127  h1tmp->GetYaxis()->SetTitle("Efficiency");
1128  h1tmp->Reset();
1129  h1tmp->Divide(h1num, h1den, 1., 1., "B");
1130  dir->cd();
1131  h1tmp->Write();
1132  }//icut
1133  }//itype
1134  mf.Write();
1135 
1136  // Triggers / Event
1137  std::vector<TString> chains;
1138  std::vector<TString> chains2;
1139 
1140  {
1141  std::map<std::string, std::string> ztpmap;
1142 
1143  ztpmap["muChain1"] = "L1_MU15";
1144  ztpmap["muChain2"] = "L1_MU15";
1145  ztpmap["muChainEFiso1"] = "L1_MU15";
1146  ztpmap["muChainEFiso2"] = "L1_MU15";
1147  ztpmap["muChainMSonly1"] = "L1_MU15";
1148  ztpmap["muChainMSonly2"] = "L1_MU15";
1149 
1150  std::map<std::string, int> ztp_isomap;
1151  ztp_isomap["muChain1"] = 0;
1152  ztp_isomap["muChain2"] = 0;
1153  ztp_isomap["muChainEFiso1"] = 1;
1154  ztp_isomap["muChainEFiso2"] = 1;
1155  ztp_isomap["muChainMSonly1"] = 0;
1156  ztp_isomap["muChainMSonly2"] = 0;
1157 
1158  for (std::map<std::string, std::string>::iterator itmap = ztpmap.begin(); itmap != ztpmap.end(); ++itmap) {
1159  TString histdirmuztp = run_dir + "/HLT/MuonMon/MuZTP/" + itmap->first;
1160  TDirectory* ztpdir = mf.GetDirectory(histdirmuztp);
1161  bool isefisochain = ztp_isomap[itmap->first] > 0;
1162 
1163  //efficiency histograms
1164  std::vector<std::string> var;
1165  var.push_back("_Pt_");
1166  var.push_back("_Pt_EC_");
1167  var.push_back("_Pt_B_");
1168  var.push_back("_Pt_4bins_");
1169  var.push_back("_Pt_B_4bins_");
1170  var.push_back("_Eta_");
1171  var.push_back("_Phi_");
1172  var.push_back("_Phi_EC_");
1173  var.push_back("_Phi_B_");
1174  for (unsigned int k = 0; k < var.size(); k++) {
1175  std::vector<std::string> level;
1176  level.push_back("L1");
1177  level.push_back("L2");
1178  level.push_back("EF");
1179  if (isefisochain) level.push_back("EFIso");
1180  for (unsigned int j = 0; j < level.size(); j++) {
1181  //ABSOLUTE
1182  seffg = histdirmuztp + "/muZTP_eff_" + level[j] + var[k] + itmap->first;
1183  snum = histdirmuztp + "/muZTP" + var[k] + level[j] + "fired_" + itmap->first;
1184  sden = histdirmuztp + "/muZTP" + var[k] + itmap->first;
1185  stmp = "muZTP_eff_" + level[j] + var[k] + itmap->first;
1186  stmpg = "muZTP_eff_" + level[j] + var[k] + itmap->first;
1187  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1188  if (!h1num) continue;
1189 
1190  h1tmpg = new TGraphAsymmErrors();
1191  h1tmpg->SetName(stmpg);
1192  h1tmpg->SetMarkerStyle(20);
1193  h1tmpg->SetMinimum(0.0);
1194  h1tmpg->SetMaximum(1.05);
1195  h1tmpg->BayesDivide(h1num, h1den);
1196  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1197  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1198  ztpdir->cd();
1199  h1tmpg->Write();
1200  delete h1tmpg;
1201  mf.Write();
1202 
1203  seffg = histdirmuztp + "/muZTP_eff_" + level[j] + "_Eta_1bin_" + itmap->first;
1204  snum = histdirmuztp + "/muZTP_Eta_1bin_" + level[j] + "fired_" + itmap->first;
1205  sden = histdirmuztp + "/muZTP_Eta_1bin_" + itmap->first;
1206  stmpg = "muZTP_eff_" + level[j] + "_Eta_1bin_" + itmap->first;
1207  const auto & [h1num2, h1den2] = getHistogramPair(snum, sden);
1208  if (!h1num2) continue;
1209 
1210  h1tmpg = new TGraphAsymmErrors();
1211  h1tmpg->SetName(stmpg);
1212  h1tmpg->SetMarkerStyle(20);
1213  h1tmpg->SetMinimum(0.0);
1214  h1tmpg->SetMaximum(1.05);
1215  h1tmpg->BayesDivide(h1num2, h1den2);
1216  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1217  h1tmpg->GetXaxis()->SetTitle(h1den2->GetXaxis()->GetTitle());
1218  ztpdir->cd();
1219  h1tmpg->Write();
1220  delete h1tmpg;
1221  mf.Write();
1222 
1223  seffg = histdirmuztp + "/muZTP_eff_" + level[j] + "_Eta_2bins_" + itmap->first;
1224  snum = histdirmuztp + "/muZTP_Eta_2bins_" + level[j] + "fired_" + itmap->first;
1225  sden = histdirmuztp + "/muZTP_Eta_2bins_" + itmap->first;
1226  stmpg = "muZTP_eff_" + level[j] + "_Eta_2bins_" + itmap->first;
1227  const auto & [h1num3, h1den3] = getHistogramPair(snum, sden);
1228 
1229  //h1num = getHPointer(snum);
1230  if (!h1num3) continue;
1231  //h1den = getHPointer(sden);
1232  //if (!h1den) continue;
1233 
1234  h1tmpg = new TGraphAsymmErrors();
1235  h1tmpg->SetName(stmp);
1236  h1tmpg->SetMarkerStyle(20);
1237  h1tmpg->SetMinimum(0.0);
1238  h1tmpg->SetMaximum(1.05);
1239  h1tmpg->BayesDivide(h1num3, h1den3);
1240  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1241  h1tmpg->GetXaxis()->SetTitle(h1den3->GetXaxis()->GetTitle());
1242  ztpdir->cd();
1243  h1tmpg->Write();
1244  delete h1tmpg;
1245  mf.Write();
1246 
1247  seffg = histdirmuztp + "/muZTP_eff_" + level[j] + "_Eta_1bin_cut_" + itmap->first;
1248  snum = histdirmuztp + "/muZTP_Eta_1bin_cut_" + level[j] + "fired_" + itmap->first;
1249  sden = histdirmuztp + "/muZTP_Eta_1bin_cut_" + itmap->first;
1250  stmpg = "muZTP_eff_" + level[j] + "_Eta_1bin_cut_" + itmap->first;
1251  const auto & [h1num4, h1den4] = getHistogramPair(snum, sden);
1252  if (!h1num4) continue;
1253 
1254  h1tmpg = new TGraphAsymmErrors();
1255  h1tmpg->SetName(stmpg);
1256  h1tmpg->SetMarkerStyle(20);
1257  h1tmpg->SetMinimum(0.0);
1258  h1tmpg->SetMaximum(1.05);
1259  h1tmpg->BayesDivide(h1num4, h1den4);
1260  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1261  h1tmpg->GetXaxis()->SetTitle(h1den4->GetXaxis()->GetTitle());
1262  ztpdir->cd();
1263  h1tmpg->Write();
1264  delete h1tmpg;
1265  mf.Write();
1266 
1267  seffg = histdirmuztp + "/muZTP_eff_" + level[j] + "_Eta_2bins_cut_" + itmap->first;
1268  snum = histdirmuztp + "/muZTP_Eta_2bins_cut_" + level[j] + "fired_" + itmap->first;
1269  sden = histdirmuztp + "/muZTP_Eta_2bins_cut_" + itmap->first;
1270  stmpg = "muZTP_eff_" + level[j] + "_Eta_2bins_cut_" + itmap->first;
1271  const auto & [h1num5, h1den5] = getHistogramPair(snum, sden);
1272  if (!h1num5) continue;
1273 
1274  h1tmpg = new TGraphAsymmErrors();
1275  h1tmpg->SetName(stmpg);
1276  h1tmpg->SetMarkerStyle(20);
1277  h1tmpg->SetMinimum(0.0);
1278  h1tmpg->SetMaximum(1.05);
1279  h1tmpg->BayesDivide(h1num5, h1den5);
1280  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1281  h1tmpg->GetXaxis()->SetTitle(h1den5->GetXaxis()->GetTitle());
1282  ztpdir->cd();
1283  h1tmpg->Write();
1284  delete h1tmpg;
1285  mf.Write();
1286 
1287  //2D ETA_PHI
1288  seff = histdirmuztp + "/muZTP_eff_EtaPhi_" + level[j] + "_" + itmap->first;
1289  snum = histdirmuztp + "/muZTP_EtaPhi_" + level[j] + "_" + itmap->first;
1290  sden = histdirmuztp + "/muZTP_EtaPhi_all_" + itmap->first;
1291  stmp = "muZTP_eff_EtaPhi_" + level[j] + "_" + itmap->first;
1292 
1293  TH2F* h2num(0);
1294  TH2F* h2den(0);
1295  TH2F* h2tmp(0);
1296 
1297  h2num = getH2Pointer(snum);
1298  if (!h2num) continue;
1299  h2den = getH2Pointer(sden);
1300  if (!h2den) continue;
1301 
1302  h2tmp = (TH2F*) h1den->Clone();
1303  h2tmp->SetName(stmp);
1304  h2tmp->SetTitle(stmp);
1305  h2tmp->GetYaxis()->SetTitle("Efficiency");
1306  h2tmp->Reset();
1307  h2tmp->Divide(h1num, h1den, 1., 1., "B");
1308  dir->cd();
1309  h2tmp->Write();
1310  mf.Write();
1311  }//level
1312 
1313  //RELATIVE
1314  seffg = histdirmuztp + "/muZTP_eff_EFwrtL2" + var[k] + itmap->first;
1315  snum = histdirmuztp + "/muZTP" + var[k] + "EFL2fired_" + itmap->first;
1316  sden = histdirmuztp + "/muZTP" + var[k] + "L2fired_" + itmap->first;
1317  stmpg = "muZTP_eff_EFwrtL2" + var[k] + itmap->first;
1318  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1319  if (!h1num) continue;
1320 
1321  h1tmpg = new TGraphAsymmErrors();
1322  h1tmpg->SetName(stmpg);
1323  h1tmpg->SetMarkerStyle(20);
1324  h1tmpg->SetMinimum(0.0);
1325  h1tmpg->SetMaximum(1.05);
1326  h1tmpg->BayesDivide(h1num, h1den);
1327  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1328  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1329  ztpdir->cd();
1330  h1tmpg->Write();
1331  delete h1tmpg;
1332  mf.Write();
1333 
1334  seffg = histdirmuztp + "/muZTP_eff_EFwrtL1" + var[k] + itmap->first;
1335  snum = histdirmuztp + "/muZTP" + var[k] + "EFfired_" + itmap->first;
1336  sden = histdirmuztp + "/muZTP" + var[k] + "L1fired_" + itmap->first;
1337  stmpg = "muZTP_eff_EFwrtL1" + var[k] + itmap->first;
1338  const auto & [h1num2, h1den2] = getHistogramPair(snum, sden);
1339  if (!h1num2) continue;
1340 
1341  h1tmpg = new TGraphAsymmErrors();
1342  h1tmpg->SetName(stmpg);
1343  h1tmpg->SetMarkerStyle(20);
1344  h1tmpg->SetMinimum(0.0);
1345  h1tmpg->SetMaximum(1.05);
1346  h1tmpg->BayesDivide(h1num2, h1den2);
1347  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1348  h1tmpg->GetXaxis()->SetTitle(h1den2->GetXaxis()->GetTitle());
1349  ztpdir->cd();
1350  h1tmpg->Write();
1351  delete h1tmpg;
1352  mf.Write();
1353 
1354  seffg = histdirmuztp + "/muZTP_eff_L2wrtL1" + var[k] + itmap->first;
1355  snum = histdirmuztp + "/muZTP" + var[k] + "L2fired_" + itmap->first;
1356  sden = histdirmuztp + "/muZTP" + var[k] + "L1fired_" + itmap->first;
1357  stmpg = "muZTP_eff_L2wrtL1" + var[k] + itmap->first;
1358  const auto & [h1num3, h1den3] = getHistogramPair(snum, sden);
1359  if (!h1num3) continue;
1360 
1361  h1tmpg = new TGraphAsymmErrors();
1362  h1tmpg->SetName(stmpg);
1363  h1tmpg->SetMarkerStyle(20);
1364  h1tmpg->SetMinimum(0.0);
1365  h1tmpg->SetMaximum(1.05);
1366  h1tmpg->BayesDivide(h1num3, h1den3);
1367  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1368  h1tmpg->GetXaxis()->SetTitle(h1den3->GetXaxis()->GetTitle());
1369  ztpdir->cd();
1370  h1tmpg->Write();
1371  delete h1tmpg;
1372  mf.Write();
1373 
1374  if (isefisochain) {
1375  seffg = histdirmuztp + "/muZTP_eff_EFIsowrtEF" + var[k] + itmap->first;
1376  snum = histdirmuztp + "/muZTP" + var[k] + "EFIsofired_" + itmap->first;
1377  sden = histdirmuztp + "/muZTP" + var[k] + "EFfired_" + itmap->first;
1378  stmpg = "muZTP_eff_EFIsowrtEF" + var[k] + itmap->first;
1379  const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1380  if (!h1num) continue;
1381 
1382  h1tmpg = new TGraphAsymmErrors();
1383  h1tmpg->SetName(stmpg);
1384  h1tmpg->SetMarkerStyle(20);
1385  h1tmpg->SetMinimum(0.0);
1386  h1tmpg->SetMaximum(1.05);
1387  h1tmpg->BayesDivide(h1num, h1den);
1388  h1tmpg->GetYaxis()->SetTitle("Efficiency");
1389  h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1390  ztpdir->cd();
1391  h1tmpg->Write();
1392  delete h1tmpg;
1393  mf.Write();
1394  }
1395  }//var
1396  }
1397  // mf.Write();
1398  } // procMuZTP
1399 
1400 
1401  {
1402  TDirectory* efdir = mf.GetDirectory(eff_dir);
1403  if (!efdir) {
1404  if (fdbg) {
1405  std::cerr << "HLTMuonHistogramDivision: directory " << eff_dir << " not found" << std::endl;
1406  }
1407  return;
1408  }
1409 
1410  // MAM
1411  const int MAXARR = 6;
1412  std::string charr[MAXARR] = {
1413  "muChain1", "muChain2", "muChainEFiso1", "muChainEFiso2", "muChainMSonly1", "muChainMSonly2"
1414  };
1415  std::string monarr[MAXARR] = {
1416  "_EFmuon", "_EFmuon", "_EFmuon", "_EFmuon", "_MuonEFSA", "_MuonEFSA"
1417  };
1418  std::string monL2arr[MAXARR] = {
1419  "_L2MuonSA", "_L2MuonSA", "_L2MuonSA", "_L2MuonSA", "_L2MuonSA", "_L2MuonSA"
1420  };
1421  bool isBarrelMon[MAXARR] = {
1422  false, false, false, false, true, true
1423  }; // enable MSonly
1424  bool isMSbMon[MAXARR] = {
1425  true, true, false, false, false, false
1426  }; // Skip isol and MSonly
1427  bool monL1[MAXARR] = {
1428  true, true, true, true, false, false
1429  }; // Skip MSonly
1430  bool isefIsolation[MAXARR] = {
1431  false, false, true, true, false, false
1432  }; // EF isolation add by Yuan
1433 
1434  // I need to prepare maps ... mu20_MG -> MuGirlEF etc.
1435  for (int ialg = 0; ialg < MAXARR; ialg++) {
1436  std::string chainName = charr[ialg];
1437  std::string MoniAlg = monarr[ialg];
1438  std::string MoniL2Alg = monL2arr[ialg];
1439 
1440  /* 1. Picking up ztp graph */
1441  TString hdirztp = muon_dir + "MuZTP/" + chainName + "/";
1442  TString histZtpNum, histZtpDen;
1443  if (!isBarrelMon[ialg]) {
1444  histZtpNum = hdirztp + "muZTP_Pt_4bins_EFfired_" + chainName;
1445  histZtpDen = hdirztp + "muZTP_Pt_4bins_L1fired_" + chainName;
1446  } else {
1447  histZtpNum = hdirztp + "muZTP_Pt_B_4bins_EFfired_" + chainName;
1448  histZtpDen = hdirztp + "muZTP_Pt_B_4bins_L1fired_" + chainName;
1449  }
1450  if (isefIsolation[ialg]) histZtpNum = hdirztp + "muZTP_Pt_4bins_EFIsofired_" + chainName; // add by Yuan
1451  TString histZtpEff = eff_dir + chainName + "_highpt3bins_effwrtL1";
1452  const auto & [h1num, h1den] = getHistogramPair(histZtpNum, histZtpDen);
1453  if (!h1num) continue;
1454  h1eff = getHPointer(histZtpEff);
1455  if (!h1eff) continue;
1456 
1457  /* 2. Filling summary histogram from ZTP values */
1458  for (int ibin = 2; ibin <= 3; ibin++) {
1459  // at the moment it is not correct if we run the algorithm # 4: mu40_MSonly_barrel .
1460  double sumeff {}, sumerr {};
1461  double sumn = h1num->Integral(ibin, ibin);
1462  if (isBarrelMon[ialg] || isMSbMon[ialg]) sumn = h1num->Integral(ibin + 1, ibin + 1);
1463  double sumd = h1den->Integral(ibin, ibin);
1464  if (isBarrelMon[ialg] || isMSbMon[ialg]) sumd = h1den->Integral(ibin + 1, ibin + 1);
1465  if (sumd != 0.) {
1466  sumeff = (double) sumn / (double) sumd;
1467  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1468  }
1469  h1eff->GetYaxis()->SetTitle("Efficiency");
1470  h1eff->SetBinContent(ibin - 1, sumeff);
1471  h1eff->SetBinError(ibin - 1, sumerr);
1472  h1eff->SetMinimum(0.0);
1473  h1eff->SetMaximum(1.05);
1474  }
1475 
1476 
1477 
1478  efdir->cd();
1479  h1eff->Write("", TObject::kOverwrite);
1480 
1481  if (monL1[ialg]) { // MUST skip muGirl, muIso and MSonly as histograms are not defined!!!
1482  TString hdirztp = muon_dir + "MuZTP/" + chainName + "/";
1483  TString histZtpNumB = hdirztp + "muZTP_Pt_B_L1fired_" + chainName;
1484  TString histZtpDenB = hdirztp + "muZTP_Pt_B_" + chainName;
1485  TString histZtpNumE = hdirztp + "muZTP_Pt_EC_L1fired_" + chainName;
1486  TString histZtpDenE = hdirztp + "muZTP_Pt_EC_" + chainName;
1487  TString histZtpL1sum = eff_dir + chainName + "_highptL1plateau_wrtOffline";
1488 
1489  TH1F* h1numb = getHPointer(histZtpNumB);
1490  if (!h1numb) continue;
1491  TH1F* h1nume = getHPointer(histZtpNumE);
1492  if (!h1nume) continue;
1493  TH1F* h1denb = getHPointer(histZtpDenB);
1494  if (!h1denb) continue;
1495  TH1F* h1dene = getHPointer(histZtpDenE);
1496  if (!h1dene) continue;
1497  TH1F* h1sumL = getHPointer(histZtpL1sum);
1498  if (!h1sumL) continue;
1499 
1500  double sumeff, sumerr;
1501  double sumn = h1numb->Integral(13, 25); // 12-25 GeV
1502  if (HI_pp_key) sumn = h1numb->Integral(13, 20); // 60-100 GeV
1503  double sumd = h1denb->Integral(13, 25);
1504  if (HI_pp_key) sumd = h1denb->Integral(13, 20);
1505  if (sumd == 0.) {
1506  sumeff = 0.;
1507  sumerr = 0.;
1508  } else {
1509  sumeff = (double) sumn / (double) sumd;
1510  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1511  }
1512  h1sumL->SetBinContent(1, sumeff);
1513  h1sumL->SetBinError(1, sumerr);
1514 
1515  sumn = h1nume->Integral(13, 25);
1516  if (HI_pp_key) sumn = h1numb->Integral(13, 20); // 60-100 GeV
1517  sumd = h1dene->Integral(13, 25);
1518  if (HI_pp_key) sumd = h1denb->Integral(13, 20);
1519  if (sumd == 0.) {
1520  sumeff = 0.;
1521  sumerr = 0.;
1522  } else {
1523  sumeff = (double) sumn / (double) sumd;
1524  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1525  }
1526  h1sumL->GetYaxis()->SetTitle("Efficiency");
1527  h1sumL->SetBinContent(2, sumeff);
1528  h1sumL->SetBinError(2, sumerr);
1529  h1sumL->SetMinimum(0.0);
1530  h1sumL->SetMaximum(1.05);
1531  efdir->cd();
1532  h1sumL->Write("", TObject::kOverwrite);
1533  }
1534  }
1535  mf.Write();
1536  } //procChainDQA_HighPt
1537  //===End HLTMuonw
1538 
1539  // ******************************************************//
1540  // ********************* generic ***********************//
1541  // ******************************************************//
1542  TString monalg[3] = {
1543  "_L2MuonSA", "_MuComb", "_EFmuon"
1544  };
1545  TString wrtalg[3] = {
1546  "_L1", "_L2MuonSA", "_MuComb"
1547  };
1548  TString numer, denom, effi;
1549  TString histdireff = eff_dir;
1550 
1551  TDirectory* efdir = mf.GetDirectory(eff_dir);
1552  if (!efdir) {
1553  if (fdbg) {
1554  std::cerr << "HLTMuonHistogramDivision: directory " << eff_dir << " not found" << std::endl;
1555  }
1556  return;
1557  }
1558 
1559  // processing Iso histograms in the same manner
1560  chainsGeneric.insert(chainsGeneric.end(), chainsEFiso.begin(), chainsEFiso.end());
1561 
1562  for (unsigned int i = 0; i < chainsGeneric.size(); i++) {
1563  TString chainName = chainsGeneric.at(i);
1564  if (fdbg) {
1565  std::cout << "proc generic " << chainName << std::endl;
1566  }
1567 
1568  //wrt CB muon && Upstream trigger
1569  for (int alg = 0; alg < 3; alg++) {
1570  denom = chainName + "_Turn_On_Curve_wrt_MuidCB_Denominator";
1571  numer = chainName + monalg[alg] + "_Turn_On_Curve_Numerator";
1572  effi = chainName + monalg[alg] + "_Turn_On_Curve_wrt_MuidCB";
1573  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1574 
1575  denom = chainName + MSchainName + "_Turn_On_Curve_wrt_MuidCB_Denominator";
1576  numer = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_Numerator";
1577  effi = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt_MuidCB";
1578  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1579 
1580  // Summary all - removed
1581 
1582  denom = chainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + "_Denominator";
1583  numer = chainName + monalg[alg] + "_Turn_On_Curve_Numerator";
1584  effi = chainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg];
1585  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1586 
1587 
1588  denom = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + "_Denominator";
1589  numer = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_Numerator";
1590  effi = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg];
1591  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1592 
1593  // for ES ------------------------------------------------------------------------------------
1594  for (int i = 0; i <= maxESbr; i++) {
1595  if (!CB_mon_ESbr[i]) continue;
1596  if (0 == alg) {
1597  // L1 efficiency: new for 2011 HI runs and afterward
1598  // only division once since it is "the zero-th" algorithm
1599  denom = chainName + triggerES[i] + "_Turn_On_Curve_wrt_MuidCB_Denominator";
1600  numer = chainName + triggerES[i] + "_L2MuonSA" + "_Turn_On_Curve_wrt" + "_L1" + "_Denominator";
1601  effi = chainName + triggerES[i] + "_L1" + "_Turn_On_Curve_wrt_MuidCB";
1602  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1603 
1604  // Need to implement barrel and endcap ...
1605  for (int be = 0; be < 2; be++) {
1606  denom = chainName + triggerES[i] + "_Turn_On_Curve_wrt_MuidCB" + bestr[be] + "_Denominator";
1607  numer = chainName + triggerES[i] + "_L2MuonSA" + "_Turn_On_Curve_wrt" + "_L1" + bestr[be] +
1608  "_Denominator";
1609  effi = chainName + triggerES[i] + "_L1" + bestr[be] + "_Turn_On_Curve_wrt_MuidCB";
1610  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1611  const auto & [h1num, h1den] = getHistogramPair(nd_dir + numer, nd_dir + denom);
1612  if (!h1num) continue;
1613 
1614  if (ESINDEP == i) {
1615  // integrating over and fill in a summary histogram
1616  double sumeff {}, sumerr {};
1617  double sumn = h1num->Integral(iSTDL, iSTDH); // 60-100 GeV
1618  double sumd = h1den->Integral(iSTDL, iSTDH);
1619 
1620  if (sumd != 0.) {
1621  sumeff = (double) sumn / (double) sumd;
1622  sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1623  }
1624 
1625  TString s = histdireff + chainName + "_L1plateau_wrtOffline_by_ESindep";
1626  TH1F* h1effL1 = getHPointer(s);
1627  if (!h1effL1) continue;
1628  h1effL1->SetBinContent(be + 1, sumeff);
1629  h1effL1->SetBinError(be + 1, sumerr);
1630  h1eff->SetMinimum(0.0);
1631  h1eff->SetMaximum(1.05);
1632  efdir->cd();
1633  h1effL1->Write("", TObject::kOverwrite);
1634  }
1635  }
1636  }
1637 
1638  denom = chainName + triggerES[i] + "_Turn_On_Curve_wrt_MuidCB_Denominator";
1639  numer = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_Numerator";
1640  effi = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_wrt_MuidCB";
1641  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1642  const auto & [h1num, h1den] = getHistogramPair(nd_dir + numer, nd_dir + denom);
1643 
1644  // Summary ESid and ESindep
1645 
1646  if (!h1num) continue;
1647  if (0 == alg || 1 == alg || 2 == alg) {
1648  double sumd {}, sumn {}, sumeff {}, sumerr {};
1649  sumn = h1num->Integral(iSTDL, iSTDH);
1650  sumd = h1den->Integral(iSTDL, iSTDH);
1651 
1652  if (sumd != 0.) {
1653  sumeff = (double) sumn / (double) sumd;
1654  sumerr = std::sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1655  }
1656  int iholx = -1;
1657  if (0 == alg) {
1658  iholx = static_cast<int>(iL2MuonSA);
1659  } else if (1 == alg) {
1660  iholx = static_cast<int>(iMuComb);
1661  } else if (2 == alg) {
1662  iholx = static_cast<int>(iEFCB);
1663  }
1664 
1665  TString s = histdireff + chainName + "_highpt_effsummary_by" + triggerES[i];
1666  h1effsum = getHPointer(s);
1667  if (!h1effsum) continue;
1668  //
1669  h1effsum->GetYaxis()->SetTitleOffset(1.3);
1670  h1effsum->SetBinContent(iholx + 1, sumeff);
1671  h1effsum->SetBinError(iholx + 1, sumerr);
1672  h1effsum->SetMinimum(0.0);
1673  h1effsum->SetMaximum(1.05);
1674  efdir->cd();
1675  h1effsum->Write("", TObject::kOverwrite);
1676  }
1677 
1678  denom = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + "_Denominator";
1679  numer = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_Numerator";
1680  effi = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg];
1681  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1682  }
1683  // for ES : END ------------------------------------------------------------------------------
1684 
1685  // Barrel/Endcap
1686  if (0 == alg || 1 == alg || 2 == alg) {
1687  for (int be = 0; be < 2; be++) {
1688  denom = chainName + "_Turn_On_Curve_wrt_MuidCB" + bestr[be] + "_Denominator";
1689  numer = chainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1690  effi = chainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidCB";
1691  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1692  }
1693 
1694  for (int be = 0; be < 2; be++) {
1695  denom = chainName + MSchainName + "_Turn_On_Curve_wrt_MuidCB" + bestr[be] + "_Denominator";
1696  numer = chainName + MSchainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1697  effi = chainName + MSchainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidCB";
1698  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1699  }
1700 
1701  for (int be = 0; be < 2; be++) {
1702  denom = chainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + bestr[be] + "_Denominator";
1703  numer = chainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1704  effi = chainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + bestr[be];
1705  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1706  }
1707 
1708 
1709  for (int be = 0; be < 2; be++) {
1710  denom = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + bestr[be] +
1711  "_Denominator";
1712  numer = chainName + MSchainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1713  effi = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + bestr[be];
1714  HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1715  }
1716  }
1717  }
1718  }
1719  }//while (now just open bracket: 110728
1720  }//MonitoringFile::HLTMuonHistogramDivision

◆ HLTMuonPostProcess()

void dqutils::MonitoringFile::HLTMuonPostProcess ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

Definition at line 42 of file MonitoringFile_HLTMuonPostProcess.cxx.

42  {
43  if (fpdbg) std::cout << "Start HLTMuon post-processing" << std::endl;
44 
45  //start postprocessing
46  TString run_dir;
47  HLTMuonHistogramDivision(inFilename, run_dir);
48 
49  //trigger overlap matrix
50  HLTMuonTriggerOverlapMatrix(inFilename, run_dir);
51 
52  if (fpdbg) std::cout << "Finish HLTMuon post-processing" << std::endl;
53 
54  return;
55  }//MonitoringFile::HLTMuonPostProcess

◆ HLTMuonTriggerOverlapMatrix()

void dqutils::MonitoringFile::HLTMuonTriggerOverlapMatrix ( const std::string &  inFilename,
TString &  run_dir 
)
static

Definition at line 71 of file MonitoringFile_HLTMuonPostProcess.cxx.

71  {
72  if (fpdbg) std::cout << " Start to fill HLTMuon Trigger Overlap Matrix" << std::endl;
73 
74  PostProcessorFileWrapper mf(inFilename, "HLT Trigger Overlap Matrix");
75  if (!mf.IsOpen()) {
76  std::cerr << "HLTMuonPostProcess(): "
77  << "Input file not opened \n";
78  return;
79  }
80  if (mf.GetSize() < 1000.) {
81  std::cerr << "HLTMuonPostProcess(): "
82  << "Input file empty \n";
83  return;
84  }
85  // get run directory name
86  //Seemingly unnecessary lines are necessary
87  TIter nextcd0(gDirectory->GetListOfKeys());
88  TKey* key0 = (TKey*) nextcd0();
89  TDirectory* dir0 = dynamic_cast<TDirectory*> (key0->ReadObj());
90  if (not dir0) {
91  std::cerr << "nullptr for dynamic cast in HLTMuonTriggerOverlapMatrix" << std::endl;
92  return;
93  }
94  dir0->cd();
96 
97  TIter next_run(mf.GetListOfKeys());
98  TKey* key_run(0);
99  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) { //== the while commented out at$
100  if (!key_run->IsFolder()) continue;
101  run_dir = key_run->GetName();
102  if (!run_dir.Contains("run")) {
103  continue;
104  }
105  break;
106  }
107  if (!run_dir.Contains("run")) {
108  std::cerr << "HLTMuon: unable to find run directory ..." << std::endl;
109  return;
110  }
111  int times = 1;
112  while (times--) { // just once
113  //run_dir = dir0->GetName();
114  if (fpdbg) {
115  std::cout << "HLTMuon: run directory is " << run_dir << std::endl;
116  }
117 
118  std::string run_dir2 = run_dir.Data();
119  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
120  //run_number=run_number;
121 
122  //===HLTMuon
123  // TString muon_dir = run_dir + "/HLT/MuonMon/";
124  TString muon_dir = "/" + run_dir + "/HLT/MuonMon/";
125 
126  TString cm_dir = muon_dir + "Common/";
127 
128  TString sol = cm_dir + "Trigger_Overlap";
129  TString solpt = cm_dir + "Trigger_Overlap_Including_Passthrough";
130  TString solf = cm_dir + "Trigger_Overlap_Fraction";
131  TString solfpt = cm_dir + "Trigger_Overlap_Fraction_Including_Passthrough";
132 
133  TH2F* hol(0);
134  TH2F* holpt(0);
135  TH2F* holf(0);
136  TH2F* holfpt(0);
137 
138  //Matrix
139  TDirectory* dir = mf.GetDirectory(cm_dir);
140  // if (fpdbg) { std::cerr << "matrix directory: " << cm_dir << std::endl; }
141  if (!dir) {
142  if (fpdbg) {
143  std::cerr << "HLTMuonTriggerOverlapMatrix: directory " << cm_dir << " not found" << std::endl;
144  }
145  return;
146  }
147 
148  mf.get(sol, hol);
149  // if (fpdbg) { std::cerr << "matrix file: " << sol << std::endl; }
150  if (!hol) {
151  if (fpdbg) {
152  std::cerr << "HLTMuon PostProcessing: no such histogram!! " << sol << std::endl;
153  }
154  continue;
155  }
156  mf.get(solpt, holpt);
157  if (!holpt) {
158  if (fpdbg) {
159  std::cerr << "HLTMuon PostProcessing: no such histogram!! " << solpt << std::endl;
160  }
161  continue;
162  }
163  mf.get(solf, holf);
164  if (!holf) {
165  if (fpdbg) {
166  std::cerr << "HLTMuon PostProcessing: no such histogram!! " << solf << std::endl;
167  }
168  continue;
169  }
170  mf.get(solfpt, holfpt);
171  if (!holfpt) {
172  if (fpdbg) {
173  std::cerr << "HLTMuon PostProcessing: no such histogram!! " << solfpt << std::endl;
174  }
175  continue;
176  }
177 
178  if (hol && holpt && holf && holfpt) {
179  holf->Reset();
180  holfpt->Reset();
181 
182  for (int i = 0; i < hol->GetXaxis()->GetNbins(); i++) {
183  Float_t diag = hol->GetBinContent(i + 1, i + 1);
184  Float_t diagpt = holpt->GetBinContent(i + 1, i + 1);
185 
186  for (int j = 0; j < hol->GetXaxis()->GetNbins(); j++) {
187  Float_t offdiag = hol->GetBinContent(i + 1, j + 1);
188  Float_t offdiagpt = holpt->GetBinContent(i + 1, j + 1);
189 
190  Float_t frac = 0.;
191  Float_t efrac = 0.;
192 
193  if (diag != 0.) {
194  frac = offdiag / diag;
195  efrac = sqrt(frac * (1. - frac) / diag);
196  }
197 
198  Float_t fracpt = 0.;
199  Float_t efracpt = 0.;
200 
201  if (diagpt != 0.) {
202  fracpt = offdiagpt / diagpt;
203  efracpt = sqrt(fracpt * (1. - fracpt) / diagpt);
204  }
205 
206  holf->SetBinContent(i + 1, j + 1, frac);
207  holf->SetBinError(i + 1, j + 1, efrac);
208 
209  holfpt->SetBinContent(i + 1, j + 1, fracpt);
210  holfpt->SetBinError(i + 1, j + 1, efracpt);
211  }//j
212  }//i
213 
214  dir->cd();
215  holf->Write("", TObject::kOverwrite);
216  holfpt->Write("", TObject::kOverwrite);
217  }//if
218  mf.Write();
219  }//while
220  }//HLTMuonTriggerOverlapMatrix

◆ HLTTauPostProcess() [1/2]

void dqutils::MonitoringFile::HLTTauPostProcess ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

Definition at line 28 of file MonitoringFile_HLTTauPostProcess.cxx.

28  {
29  //std::cout << "--> HLTTauPostProcess: Begin HLT Tau post-processing" << std::endl;
30 
31  //open root file
32  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
33 
34  //check files are loaded.
35  if (f == 0 || !f->IsOpen()) {
36  //std::cerr << "--> HLTTauPostProcess: Input file not opened" << std::endl;
37  delete f;
38  return;
39  }
40 
41  //zombie files?
42  if (f->IsZombie()) {
43  //std::cerr << "--> HLTTauPostProcess: Input file " << inFilename << " cannot be opened. " << std::endl;
44  delete f;
45  return;
46  }
47 
48  //check file size is not too small.
49  if (f->GetSize() < 1000.) {
50  //std::cerr << "--> HLTTauPostProcess: Input file empty" << std::endl;
51  f->Close();
52  delete f;
53  return;
54  }
55 
56 
57  //making sure we are in the right directory
58  // f->cd("/");
59  // f->pwd();
60  // f->ls();
61 
62  //build iterator
63  TIter next_run(f->GetListOfKeys());
64  TKey* key_run(0);
65 
66  //loop over keys in root directory
67  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
68  TObject* obj_run = key_run->ReadObj();
69  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
70 
71  //check we have a valid pointer
72  if (tdir_run == 0) {
73  delete obj_run;
74  continue;
75  }
76 
77  //check name
78  std::string runDirName(tdir_run->GetName());
79  //std::cout<<"Run_directory: "<<runDirName<<std::endl;
80 
81  if (runDirName.find("run") == std::string::npos) {
82  delete obj_run;
83  continue;
84  }
85 
86  //find tauMon dir
87  TString taumonDirName = runDirName + "/HLT/TauMon";
88  TDirectory* taumonDir(0);
89  if (!(taumonDir = f->GetDirectory(taumonDirName))) {
90  //std::cerr << "--> HLTTauPostProcess: directory " << taumonDirName << " not found." << std::endl;
91  return;
92  }
93 
94 
95  std::vector<TString> varName;
96  varName.push_back("Et");
97  varName.push_back("Eta");
98  varName.push_back("Phi");
99 
100  std::vector<TString> lvlName;
101  lvlName.push_back("L1");
102  lvlName.push_back("L2");
103  lvlName.push_back("EF");
104 
105  std::vector< std::pair< int, int > > ratioIndex;
106  ratioIndex.push_back(std::make_pair(2, 0)); // EF vs L1
107  ratioIndex.push_back(std::make_pair(1, 0)); // L2 vs L1
108  ratioIndex.push_back(std::make_pair(2, 1)); // EF vs L2
109 
110 
111 
112  std::vector<TString> varName0;
113  varName0.push_back("Pt");
114  varName0.push_back("Eta");
115  varName0.push_back("Phi");
116  varName0.push_back("Nvtx");
117 
118  std::vector<TString> lvlNameO;
119  lvlNameO.push_back("L1");
120  lvlNameO.push_back("L2");
121  lvlNameO.push_back("EF");
122  lvlNameO.push_back("");//offline
123 
124  std::vector< std::pair< int, int > > ratioIndexO;
125  ratioIndexO.push_back(std::make_pair(0, 3)); // L1 vs off
126  ratioIndexO.push_back(std::make_pair(1, 3)); // L2 vs off
127  ratioIndexO.push_back(std::make_pair(2, 3)); // EF vs off
128 
129 
130  //loop over directories
131  TIter next_trig(taumonDir->GetListOfKeys());
132  TKey* key_trig(0);
133  while ((key_trig = dynamic_cast<TKey*>(next_trig())) != 0) {
134  TObject* obj_trig = key_trig->ReadObj();
135  TDirectory* dir_trig = dynamic_cast<TDirectory*>(obj_trig);
136  if (!dir_trig) continue;
137  //std::cout<<"--> HLTTauPostProcess: calling functions for " << dir_trig->GetName() << endl;
138  // "<<runDirName<<" and trigger item="<<dir_trig->GetName()<<endl;
139 
140  HLTTauPostProcess(f, dir_trig, "/RelativeEfficiency", "/RelativeEfficiency/Efficiency",
141  lvlName, varName, ratioIndex, 1);//name style : 1 (relative eff)
142  HLTTauPostProcess(f, dir_trig, "/OfflineRatio", "/OfflineRatio/Ratio",
143  lvlNameO, varName0, ratioIndexO, 2);//name style : 2 (offline eff)
144  HLTTauPostProcess(f, dir_trig, "/OfflineRatio/BDTMedium", "/OfflineRatio/Ratio/BDTMedium",
145  lvlNameO, varName0, ratioIndexO, 2, "BDTMedium");//name style : 2 (offline eff)
146  }
147  }
148 
149  f->Close();
150  delete f;
151  //std::cout << "--> HLTTauPostProcess: finished HLT Tau post-processing"<<std::endl;
152  }

◆ HLTTauPostProcess() [2/2]

void dqutils::MonitoringFile::HLTTauPostProcess ( TFile *  f,
TDirectory *  dir,
TString  pathApp,
TString  pathAppEff,
const std::vector< TString > &  lvlN,
const std::vector< TString > &  varN,
const std::vector< std::pair< int, int > > &  ratioIndex,
int  nameStyle,
TString  nameApp = "" 
)
static

Definition at line 154 of file MonitoringFile_HLTTauPostProcess.cxx.

158  {
159  std::string path = getPath(dir);
160 
161  //cout<<"HLTTauPostProcess in "<< path
162 // <<" pathApp="<<pathApp
163 // <<" pathAppEff="<<pathAppEff
164 // <<" nameStyle="<<nameStyle<<endl;
165 
166  TString basePath = path + pathApp + "/";
167  if (f->cd(basePath.Data()) == 0) {
168  //cout<<"basePath isn't there!"<<endl;
169  return;
170  }
171 
172  //TH1F* hRoI[lvlN.size()][varN.size()];
173  TH1F* hRoI[100][100];
174  for (unsigned int iLvl = 0; iLvl < lvlN.size(); iLvl++) {
175  for (unsigned int iVar = 0; iVar < varN.size(); iVar++) {
176  TString hName;
177  if (nameStyle == 1) hName = basePath + "h" + lvlN[iLvl] + "RoI" + varN[iVar] + (iLvl == 0 ? "Denom" : "Num") + nameApp;
178  if (nameStyle == 2) hName = basePath + "hTau" + varN[iVar] + lvlN[iLvl] + nameApp;
179  if (!CheckHistogram(f, hName.Data())) {
180  //cout<<" histo "<<hName<<" is not in f "<<f->GetName()<<endl;
181  return;
182  }
183  hRoI[iLvl][iVar] = (TH1F*) (f->Get(hName.Data()))->Clone();
184  }
185  }
186 
187 
188  basePath += path + pathAppEff + "/";
189  f->cd(basePath.Data());
190  TH1F* hEff[100][100];
191  for (unsigned int iVar = 0; iVar < varN.size(); iVar++) {
192  for (unsigned int iRatio = 0; iRatio < ratioIndex.size(); iRatio++) {
193  TString hName;
194  if (nameStyle == 1)
195  hName = basePath + "h" +
196  lvlN[ ratioIndex[ iRatio ].first ] + "vs" + lvlN[ ratioIndex[ iRatio ].second ] +
197  varN[iVar] + "Efficiency" + nameApp;
198 
199  if (nameStyle == 2)
200  hName = basePath + "h" +
201  lvlN[ ratioIndex[ iRatio ].first ] + "OfflineRatio" +
202  varN[iVar] + nameApp;
203 
204  if (!CheckHistogram(f, hName.Data())) return;
205 
206  hEff[iRatio][iVar] = (TH1F*) (f->Get(hName.Data()));
207  hEff[iRatio][iVar]->Divide(hRoI[ ratioIndex[ iRatio ].first ][iVar],
208  hRoI[ ratioIndex[ iRatio ].second ][iVar],
209  1.0, 1.0, "b");
210 
211  hEff[iRatio][iVar]->Write("", TObject::kOverwrite);
212  }
213  }
214 
215  f->Write();
216  }

◆ IterativeGaussFit()

int dqutils::MonitoringFile::IterativeGaussFit ( TH1 *  hist,
double &  mu,
double &  mu_err,
double &  sigma,
double &  sigma_err 
)
static

Definition at line 2997 of file MonitoringFile_IDAlignPostProcess.cxx.

2998  {
2999  //constants for fitting algorithm
3000  const int iteration_limit = 20;
3001  const float percent_limit = 0.01;
3002  const float fit_range_multiplier = 1.5;
3003  const int fDebug = 0;
3004 
3005  double last_mu;
3006  double last_sigma;
3007  double current_mu;
3008  double current_sigma;
3009  double mu_percent_diff;
3010  double sigma_percent_diff;
3011 
3012  if (!hist) {
3013  if (fDebug) std::cout << "Error in Anp::IterativeGaussFit(): Histogram to be fit is missing" << std::endl;
3014  return 1;
3015  }
3016 
3017  TF1* fit_func = new TF1("fit_func", "gaus");
3018 
3019  int bad_fit = hist->Fit(fit_func, "QN");
3020 
3021  if (fDebug && bad_fit) std::cout << "BAD INITIAL FIT: " << hist->GetTitle() << std::endl;
3022 
3023  last_mu = fit_func->GetParameter(1);
3024  last_sigma = fit_func->GetParameter(2);
3025 
3026  if (bad_fit) last_mu = hist->GetMean();
3027 
3028  // check as well that the last_mu is reasonable
3029  if (fabs(last_mu - hist->GetMean()) > 5 * hist->GetBinWidth(1)) last_mu = hist->GetMean();
3030 
3031  fit_func->SetRange(last_mu - fit_range_multiplier * last_sigma, last_mu + fit_range_multiplier * last_sigma);
3032 
3033  int iteration = 0;
3034 
3035  while (iteration < iteration_limit) {
3036  iteration++;
3037 
3038  double FitRangeLower = last_mu - fit_range_multiplier * last_sigma;
3039  double FitRangeUpper = last_mu + fit_range_multiplier * last_sigma;
3040 
3041  // if range is to narrow --> broaden it
3042  if ((FitRangeUpper - FitRangeLower) / hist->GetBinWidth(1) < 4) {
3043  FitRangeLower -= hist->GetBinWidth(1);
3044  FitRangeUpper += hist->GetBinWidth(1);
3045  }
3046 
3047  fit_func->SetRange(FitRangeLower, FitRangeUpper);
3048 
3049  bad_fit = hist->Fit(fit_func, "RQN");
3050 
3051  if (fDebug &&
3052  bad_fit) std::cout << " ** BAD FIT ** : bin " << hist->GetTitle() << " iteration " << iteration << std::endl;
3053 
3054 
3055  current_mu = fit_func->GetParameter(1);
3056  current_sigma = fit_func->GetParameter(2);
3057 
3058  float average_mu = (last_mu + current_mu) / 2;
3059  float average_sigma = (last_sigma + current_sigma) / 2;
3060 
3061  if (average_mu == 0) {
3062  if (fDebug) std::cout << " Average mu = 0 in bin " << hist->GetTitle() << std::endl;
3063  average_mu = current_mu;
3064  }
3065 
3066  if (average_sigma == 0) {
3067  if (fDebug) std::cout << "Average sigma = 0; Fit Problem in " << hist->GetTitle() << ". " << last_sigma <<
3068  " " << current_sigma << std::endl;
3069  average_sigma = current_sigma;
3070  }
3071 
3072  mu_percent_diff = fabs((last_mu - current_mu) / average_mu);
3073  sigma_percent_diff = fabs((last_sigma - current_sigma) / average_sigma);
3074 
3075  if (mu_percent_diff < percent_limit && sigma_percent_diff < percent_limit) break;
3076 
3077  if (iteration != iteration_limit) { //necessary?
3078  last_mu = current_mu;
3079  last_sigma = current_sigma;
3080  }
3081  // check as well that the last_mu is reasonable
3082  if (fabs(last_mu - hist->GetMean()) > 5 * hist->GetBinWidth(1)) {
3083  last_mu = hist->GetMean();
3084  }
3085  }
3086 
3087  if (iteration == iteration_limit) {
3088  if (fDebug) std::cout << "WARNING: Fit did not converge to < " << percent_limit * 100 << "% in " <<
3089  hist->GetTitle() << " in " << iteration_limit << " iterations. Percent Diffs: " << mu_percent_diff * 100 <<
3090  "% (Mu)," << " " << sigma_percent_diff * 100 << "% (Sigma)" << std::endl;
3091  //possibly return a value other than 0 to indicate not converged?
3092  }
3093 
3094  mu = current_mu;
3095  mu_err = fit_func->GetParError(1);
3096  sigma = current_sigma;
3097  sigma_err = fit_func->GetParError(2);
3098  fit_func->SetLineColor(kRed);
3099 
3100  hist->GetListOfFunctions()->Add(fit_func);
3101 
3102  return 0;
3103  }

◆ L1CaloFillWithError()

void dqutils::MonitoringFile::L1CaloFillWithError ( TFile *  f,
const TString &  nameDir,
const TString &  nameData,
const TString &  nameError 
)
static

Definition at line 141 of file MonitoringFile_L1CaloPostProcess.cxx.

142  {
143  const bool debug = L1CALOPOSTPROCESSDEBUG;
144 
145  // Check directory
146  if (!(f->GetDirectory(nameDir))) {
147  if (debug) std::cout << "--> L1CaloPostProcess: directory "
148  << nameDir << " not found." << std::endl;
149  return;
150  }
151  if (f->cd(nameDir.Data()) == 0) {
152  if (debug) std::cout << "dir " << nameDir << " isn't there!" << std::endl;
153  return;
154  }
155 
156  // Data histogram
157  TString p1 = nameDir + "/" + nameData;
158  if (!CheckHistogram(f, p1.Data())) {
159  if (debug) std::cout << " histo " << p1.Data() << " is not in file "
160  << f->GetName() << std::endl;
161  return;
162  }
163  TH1* h1 = (TH1*) (f->Get(p1.Data()));
164 
165  // Error histogram
166  TString p2 = nameDir + "/" + nameError;
167  if (!CheckHistogram(f, p2.Data())) {
168  if (debug) std::cout << " histo " << p2.Data() << " is not in file "
169  << f->GetName() << std::endl;
170  return;
171  }
172  TH1* h2 = (TH1*) (f->Get(p2.Data()));
173 
174  // Consistency checks
175  const int dim = h1->GetDimension();
176  if (dim != h2->GetDimension()) {
177  if (debug) std::cout << "Histograms have different dimension" << std::endl;
178  return;
179  }
180  if (h1->GetNbinsX() != h2->GetNbinsX() ||
181  ((dim == 2) && (h1->GetNbinsY() != h2->GetNbinsY()))) {
182  if (debug) std::cout << "Histograms have different number of bins" << std::endl;
183  return;
184  }
185 
186  // Fill error histogram
187  h2->Reset();
188  int nbins = h1->GetNbinsX() + 2;
189  if (dim == 2) nbins *= (h1->GetNbinsY() + 2);
190  for (int bin = 0; bin < nbins; ++bin) {
191  double error = h1->GetBinError(bin);
192  if (error != 0.) h2->SetBinContent(bin, error);
193  }
194 
195  // And save
196  h2->Write("", TObject::kOverwrite);
197  f->Write();
198  }

◆ L1CaloPostProcess()

void dqutils::MonitoringFile::L1CaloPostProcess ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 29 of file MonitoringFile_L1CaloPostProcess.cxx.

29  {
31 
32  if (debug) std::cout << "--> L1CaloPostProcess: Begin L1Calo post-processing" << std::endl;
33 
34  //open root file
35  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
36 
37  //check files are loaded.
38  if (f == 0 || !f->IsOpen()) {
39  std::cerr << "--> L1CaloPostProcess: Input file not opened" << std::endl;
40  delete f;
41  return;
42  }
43 
44  //zombie files?
45  if (f->IsZombie()) {
46  std::cerr << "--> L1CaloPostProcess: Input file " << inFilename << " cannot be opened. " << std::endl;
47  delete f;
48  return;
49  }
50 
51  //check file size is not too small.
52  if (f->GetSize() < 1000.) {
53  std::cerr << "--> L1CaloPostProcess: Input file empty" << std::endl;
54  f->Close();
55  delete f;
56  return;
57  }
58 
59  //build iterator
60  TIter next_run(f->GetListOfKeys());
61  TKey* key_run(0);
62 
63  //loop over keys in root directory
64  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
65  TObject* obj_run = key_run->ReadObj();
66  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
67 
68  //check we have a valid pointer
69  if (tdir_run == 0) {
70  delete obj_run;
71  continue;
72  }
73 
74  //check name
75  std::string runDirName(tdir_run->GetName());
76  if (debug) std::cout << "Run_directory: " << runDirName << std::endl;
77 
78  if (runDirName.find("run") == std::string::npos) {
79  delete obj_run;
80  continue;
81  }
82 
83  // Stability RMS histograms
84  TString stabilityDirName = runDirName + "/L1Calo/PPM/Stability";
85  L1CaloStabilityRMS(f, stabilityDirName + "/FineTime", "fineTime");
86  L1CaloStabilityRMS(f, stabilityDirName + "/Pedestal", "pedestal");
87  L1CaloStabilityRMS(f, stabilityDirName + "/EtCorrelation", "etCorrelation");
88 
89  // Trigger efficiency eta-phi histograms
90  int items = 16;
91  int binSkip = 8;
92  double threshold[6] = {
93  3., 3., 3., 6., 4., 2.
94  };
95  TString energies[6] = {
96  "10", "20", "30", "50", "100", "200"
97  };
98  for (int i = 0; i < 3; ++i) {
99  TString effDir = runDirName + "/L1Calo/Reco/EmEfficiencies/ClusterRaw_"
100  + energies[i] + "GeV_EtaVsPhi";
101  TString nameDen = "ClusterRaw_" + energies[i] + "GeV_Eta_vs_Phi";
102  TString nameEff = nameDen + "_trig_Eff";
103  L1CaloResetEfficiencies(f, effDir, nameDen, nameEff, items, threshold[i], binSkip);
104  }
105  items = 8;
106  binSkip = 6;
107  int itemsF = 4;
108  int binSkipF = 0;
109  for (int i = 3; i < 6; ++i) {
110  TString effDir = runDirName + "/L1Calo/Reco/JetEfficiencies/JetEmScale_"
111  + energies[i] + "GeV_EtaVsPhi";
112  TString nameDen = "JetEmScale_" + energies[i] + "GeV_Eta_vs_Phi";
113  TString nameEff = nameDen + "_J_Eff_item";
114  TString nameEffF = nameDen + "_FJ_J_Eff_item";
115  L1CaloResetEfficiencies(f, effDir, nameDen, nameEff, items, threshold[i], binSkip);
116  L1CaloResetEfficiencies(f, effDir, nameDen, nameEffF, itemsF, threshold[i], binSkipF);
117  }
118  }
119 
120  f->Close();
121  delete f;
122  if (debug) std::cout << "--> L1CaloPostProcess: finished L1Calo post-processing"
123  << std::endl;
124  }

◆ L1CaloResetEfficiencies()

void dqutils::MonitoringFile::L1CaloResetEfficiencies ( TFile *  f,
const TString &  effDir,
const TString &  nameDen,
const TString &  nameEff,
int  items,
double  threshold,
int  binSkip 
)
static

Definition at line 202 of file MonitoringFile_L1CaloPostProcess.cxx.

204  {
205  const bool debug = L1CALOPOSTPROCESSDEBUG;
206 
207  // Check directory
208  if (!(f->GetDirectory(effDir))) {
209  if (debug) std::cout << "--> L1CaloPostProcess: directory "
210  << effDir << " not found." << std::endl;
211  return;
212  }
213  if (f->cd(effDir.Data()) == 0) {
214  if (debug) std::cout << "dir " << effDir << " isn't there!" << std::endl;
215  return;
216  }
217 
218  // Denominator histogram
219  TString denPath = effDir + "/denominator/" + nameDen;
220  TH1* h1 = (TH1*) (f->Get(denPath.Data()));
221  if (!h1) {
222  if (debug) std::cout << " histo " << denPath << " is not in file "
223  << f->GetName() << std::endl;
224  return;
225  }
226  if (h1->GetDimension() != 2) {
227  if (debug) std::cout << " histo " << denPath << " has unexpected dimension"
228  << std::endl;
229  return;
230  }
231 
232  // Efficiency histograms
233  int xbins = h1->GetNbinsX();
234  int ybins = h1->GetNbinsY();
235  std::vector<TH1*> effVec;
236  TString str;
237  TString effBase = effDir + "/" + nameEff;
238  for (int i = 0; i < items; ++i) {
239  str.Form("_%i", i);
240  TString effPath = effBase + str;
241  TH1* h2 = (TH1*) (f->Get(effPath.Data()));
242  if (!h2) {
243  if (debug) std::cout << " histo " << effPath << " is not in file "
244  << f->GetName() << std::endl;
245  continue;
246  }
247  if (h2->GetDimension() != 2) {
248  if (debug) std::cout << " histo " << effPath << " has unexpected dimension"
249  << std::endl;
250  continue;
251  }
252  if (xbins != h2->GetNbinsX() || ybins != h2->GetNbinsY()) {
253  if (debug) std::cout << " histos " << denPath << " and " << effPath
254  << " have different number of bins" << std::endl;
255  continue;
256  }
257  effVec.push_back(h2);
258  }
259  if (effVec.empty()) {
260  if (debug) std::cout << "No valid histograms in " << effDir << std::endl;
261  return;
262  }
264  std::vector<TH1*>::iterator iterEnd = effVec.end();
265 
266  // Loop over bins in denominator looking for entries below threshold
267  for (int x = 1 + binSkip; x <= xbins - binSkip; ++x) {
268  for (int y = 1; y <= ybins; ++y) {
269  if (h1->GetBinContent(x, y) < threshold) {
270  // Loop over efficiency histograms and set bin to 100% efficiency
271  for (iter = effVec.begin(); iter != iterEnd; ++iter) {
272  (*iter)->SetBinContent(x, y, 100.0);
273  }
274  }
275  }
276  }
277 
278  // Save the updated histograms
279  for (iter = effVec.begin(); iter != iterEnd; ++iter) {
280  (*iter)->Write("", TObject::kOverwrite);
281  }
282  f->Write();
283  }

◆ L1CaloStabilityRMS()

void dqutils::MonitoringFile::L1CaloStabilityRMS ( TFile *  f,
const TString &  nameDir,
const TString &  nameTag 
)
static

Definition at line 128 of file MonitoringFile_L1CaloPostProcess.cxx.

129  {
130  TString nameData("ppm_em_2d_profile_etaPhi_adc_" + nameTag);
131  TString nameError("ppm_em_2d_etaPhi_adc_" + nameTag + "RMS");
132 
133  L1CaloFillWithError(f, nameDir, nameData, nameError);
134  nameData = "ppm_had_2d_profile_etaPhi_adc_" + nameTag;
135  nameError = "ppm_had_2d_etaPhi_adc_" + nameTag + "RMS";
136  L1CaloFillWithError(f, nameDir, nameData, nameError);
137  }

◆ loopOnHistograms()

static void dqutils::MonitoringFile::loopOnHistograms ( HistogramOperation fcn,
TDirectory *  dir 
)
staticprotected

◆ loopOnHistogramsInMetadata()

static bool dqutils::MonitoringFile::loopOnHistogramsInMetadata ( HistogramOperation fcn,
TDirectory *  dir 
)
staticprotected

◆ Make1DProfile()

void dqutils::MonitoringFile::Make1DProfile ( TH1 *  output,
TH2 *  histo 
)
static

Definition at line 2943 of file MonitoringFile_IDAlignPostProcess.cxx.

2944  {
2945  int nXbins = histo->GetXaxis()->GetNbins(); //NEED TO CHANGE THIS
2946 
2947  for (int i = 0; i < nXbins; i++) {
2948  double current_mu;
2949  double current_err_mu;
2950  double current_sigma;
2951  double current_err_sigma;
2952 
2953  TH1D* projection = histo->ProjectionY("projection", i + 1, i + 1);
2954  IterativeGaussFit(projection, current_mu, current_err_mu, current_sigma, current_err_sigma);
2955 
2956  output->SetBinContent(i, current_mu);
2957  output->SetBinError(i, current_err_mu);
2958  }
2959  }

◆ MakeMap()

void dqutils::MonitoringFile::MakeMap ( TH2 *  outputhist,
TH3 *  hist 
)
static

Definition at line 2962 of file MonitoringFile_IDAlignPostProcess.cxx.

2963  {
2964  int num_bins = 1; //WHAT IS THIS AGAIN
2965 
2966  int num_bins_x = hist->GetXaxis()->GetNbins();
2967  int num_bins_y = hist->GetYaxis()->GetNbins();
2968 
2969  TH1D* current_proj;
2970 
2971  for (int i = 1; i < num_bins_x + (num_bins == 1); i += num_bins) {
2972  for (int j = 1; j < num_bins_y + (num_bins == 1); j += num_bins) {
2973  int index = i / num_bins;
2974  int index_y = j / num_bins;
2975 
2976  current_proj = hist->ProjectionZ(Form("%s_GaussProjection_%i_%i",
2977  hist->GetName(), index, index_y), i, i + num_bins - 1, j,
2978  j + num_bins - 1);
2979  current_proj->SetTitle(Form("%s - Bin %i x %i", hist->GetName(), index, index_y));
2980 
2981  //Fit the gauss
2982  double current_mu, current_err_mu, current_sigma, current_err_sigma;
2983  IterativeGaussFit(current_proj, current_mu, current_err_mu, current_sigma, current_err_sigma);
2984 
2985  //Fill the maps
2986  float x_coord = (hist->GetXaxis()->GetBinLowEdge(i) + hist->GetXaxis()->GetBinUpEdge(i + num_bins - 1)) / 2;
2987  float y_coord = (hist->GetYaxis()->GetBinLowEdge(j) + hist->GetYaxis()->GetBinUpEdge(j + num_bins - 1)) / 2;
2988 
2989  outputhist->Fill(x_coord, y_coord, current_mu);
2990 
2991  delete current_proj;
2992  } //end loop on j (y)
2993  } //end loop on i (x)
2994  }

◆ MDTvsTGCEfficiency()

void dqutils::MonitoringFile::MDTvsTGCEfficiency ( const std::string &  inFilename)
static

Definition at line 43 of file MonitoringFile_MDTvsTGCPostProcess.cxx.

43  {
44  PostProcessorFileWrapper mf(inFilename, "MDTvsTGC Efficiency");
45 
46  if (!mf.IsOpen()) {
47  //std::cerr << "MDTvsTGCEfficiency(): "
48  // << "Input file not opened \n";
49  return;
50  }
51  if (mf.GetSize() < 1000.) {
52  //std::cerr << "MDTvsTGCEfficiency(): "
53  // << "Input file empty \n";
54  return;
55  }
56 
57  std::stringstream ss;
58  TString sac[2] = {
59  "A", "C"
60  };
61  TString sws[2] = {
62  "Wire", "Strip"
63  };
64  TString smethod[3] = {
65  "SegmTrack", "MidOnly", ""
66  };
67 
68  TIter next_run(mf.GetListOfKeys());
69  TKey* key_run(0);
70  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
71  if (!key_run->IsFolder()) continue;
72  TString run_dir = key_run->GetName();
73  if (!run_dir.Contains("run")) continue;
74 
75  TString seff;
76  TString snum;
77  TString sden;
78  TString serr;
79 
80  TH2F* h2eff(0);
81  TH2F* h2num(0);
82  TH2F* h2den(0);
83  TH2F* h2err(0);
84 
85  TString mdtvstgc_dir = run_dir + "/Muon/MuonRawDataMonitoring/MDTvsTGC/";
86 
87  TString mdtvstgc_sub_dir[2] = {
88  mdtvstgc_dir + "TGCEA/", mdtvstgc_dir + "TGCEC/"
89  };
90 
91  if (mf.cd(mdtvstgc_dir)) mf.cd(mdtvstgc_dir);
92  else {
93  //std::cerr << "No MDTvsTGC Directory! " << std::endl; mf.error();
94  return;
95  }
96 
97  for (int ac = 0; ac < 2; ac++) {
98  TString eff_dir = mdtvstgc_sub_dir[ac];
99  TDirectory* dir = mf.GetDirectory(eff_dir);
100  if (!dir) {
101  //std::cerr<< "TGCHistogramDivision: directory "<<eff_dir<<" not found"<<std::endl;
102  return;
103  }
104 
105  for (int ws = 0; ws < 2; ws++) {
106  // Merge SegmTrack and Midstation-only method results together to make total histograms
107  bool oktomerge = true;
108 
109  TList* nummergelist = new TList();
110  for (int imethod = 0; imethod < 2; imethod++) {
111  ss << sws[ws] << "_EfficiencyAgainstMDT_Map" << smethod[imethod] << "num_" << sac[ac];
112  snum = ss.str();
113  ss.str("");
114  h2num = 0;
115  mf.get(snum, h2num, dir);
116  if (!h2num) {
117  //std::cerr <<"MDTvsTGC PostProcessing: no such histogram!! "<< snum << std::endl;
118  oktomerge = false;
119  }
120  nummergelist->Add(h2num);
121  }
122  ss << sws[ws] << "_EfficiencyAgainstMDT_Map" << smethod[2] << "num_" << sac[ac];
123  snum = ss.str();
124  ss.str("");
125  h2num = 0;
126  mf.get(snum, h2num, dir);
127  if (!h2num) {
128  //std::cerr <<"MDTvsTGC PostProcessing: no such histogram!! "<< snum << std::endl;
129  oktomerge = false;
130  }
131 
132  TList* denmergelist = new TList();
133  for (int imethod = 0; imethod < 2; imethod++) {
134  ss << sws[ws] << "_EfficiencyAgainstMDT_Map" << smethod[imethod] << "denom_" << sac[ac];
135  sden = ss.str();
136  ss.str("");
137  h2den = 0;
138  mf.get(sden, h2den, dir);
139  if (!h2den) {
140  //std::cerr <<"MDTvsTGC PostProcessing: no such histogram!! "<< sden << std::endl;
141  oktomerge = false;
142  }
143  denmergelist->Add(h2den);
144  }
145  ss << sws[ws] << "_EfficiencyAgainstMDT_Map" << smethod[2] << "denom_" << sac[ac];
146  sden = ss.str();
147  ss.str("");
148  h2den = 0;
149  mf.get(sden, h2den, dir);
150  if (!h2den) {
151  //std::cerr <<"MDTvsTGC PostProcessing: no such histogram!! "<< sden << std::endl;
152  oktomerge = false;
153  }
154 
155  if (oktomerge) {
156  MDTvsTGCResetContents(h2num);
157  MDTvsTGCResetContents(h2den);
158  h2num->Merge(nummergelist);
159  h2den->Merge(denmergelist);
160 
161  dir->cd();
162  h2num->Write("", TObject::kOverwrite);
163  h2den->Write("", TObject::kOverwrite);
164  }
165 
166  // Postprocess all methods
167  for (int imethod = 0; imethod < 3; imethod++) {
168  ss.str("");
169  ss << sws[ws] << "_EfficiencyAgainstMDT_Map" << smethod[imethod] << "_" << sac[ac];
170  seff = ss.str();
171  ss.str("");
172  ss << sws[ws] << "_EfficiencyAgainstMDT_Map" << smethod[imethod] << "num_" << sac[ac];
173  snum = ss.str();
174  ss.str("");
175  ss << sws[ws] << "_EfficiencyAgainstMDT_Map" << smethod[imethod] << "denom_" << sac[ac];
176  sden = ss.str();
177  ss.str("");
178  ss << sws[ws] << "_EfficiencyAgainstMDT_Map" << smethod[imethod] << "error_" << sac[ac];
179  serr = ss.str();
180  ss.str("");
181 
182  h2eff = 0;
183  mf.get(seff, h2eff, dir);
184  h2num = 0;
185  mf.get(snum, h2num, dir);
186  h2den = 0;
187  mf.get(sden, h2den, dir);
188  h2err = 0;
189  mf.get(serr, h2err, dir);
190 
191  if (h2eff && h2num && h2den) {
192  MDTvsTGCResetContents(h2eff);
193  h2eff->Divide(h2num, h2den, 1., 1., "B");
194 
195  // Make Error Histograms
196  int nX = h2eff->GetNbinsX();
197  int nY = h2eff->GetNbinsY();
198  int beff, bdenom, berror;
199  float feff, fdenom, ferror;
200  for (int x = 1; x <= nX; x++) {
201  for (int y = 1; y <= nY; y++) {
202  beff = h2eff->GetBin(x, y);
203  bdenom = h2den->GetBin(x, y);
204  feff = h2eff->GetBinContent(beff);
205  fdenom = h2den->GetBinContent(bdenom);
206  ferror = sqrt(feff * (1 - feff) / fdenom);
207 
208  if (h2err) {
209  berror = h2err->GetBin(x, y);
210  h2err->SetBinContent(berror, ferror);
211  }
212  h2eff->SetBinError(beff, ferror);
213  }
214  }
215  } else {
216  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
217  continue;
218  }
219  // save histograms
220  dir->cd();
221  h2eff->Write("", TObject::kOverwrite);
222  if (h2err) h2err->Write("", TObject::kOverwrite);
223  }// method
224  }// wirestrip
225  mf.Write();
226  }// ac
227  }// run_dir
228  mf.Write();
229  }

◆ MDTvsTGCPostProcess()

void dqutils::MonitoringFile::MDTvsTGCPostProcess ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

Definition at line 37 of file MonitoringFile_MDTvsTGCPostProcess.cxx.

37  {
38  //start postprocessing
39  MDTvsTGCEfficiency(inFilename);
40  }

◆ MDTvsTGCResetContents()

void dqutils::MonitoringFile::MDTvsTGCResetContents ( TH1 *  h)
static

Definition at line 232 of file MonitoringFile_MDTvsTGCPostProcess.cxx.

232  {
233  // copy all functions of histogram before resetting
234  TList* h_funcs;
235 
236  h_funcs = dynamic_cast<TList*> (h->GetListOfFunctions()->Clone());
237  h->Reset();
238  //now insert these functions back into the hist
239  TIter iterE(h_funcs);
240  while ((iterE())) {
241  h->GetListOfFunctions()->Add(*iterE);
242  }
243  delete h_funcs;
244  // are the functions still valid after list deletion?
245  //http://root.cern.ch/root/html/TList#TList:_TList should be!
246  // TIter iterTest(EffBCap->GetListOfFunctions());
247  // while( iterTest() ) std::cout << (*iterTest)->GetName() << std::endl;
248  }

◆ meanRMSProjections2D()

void dqutils::MonitoringFile::meanRMSProjections2D ( TH2F *  h2d,
TH1F *  h,
int  iopt 
)
static

Definition at line 3128 of file MonitoringFile_IDAlignPostProcess.cxx.

3129  {
3130  //fills a 1-D histogram with mean or width of the distribution for each bin in a 2D histogram
3131  //the way in which the mean or width is determined is specified by the iopt option
3132  //can be from a gaussian fit for example
3133  // iopt = 0; fills with statistical mean
3134  // iopt = 1; fills with statistical RMS
3135  // iopt = 2; fills with mean of a two-stage Gaussian fit
3136  // iopt = 3; fills with width of a two-stage Gaussian fit
3137  // iopt = 4; fills with Chi2/DOF of a two-stage Gaussian fit
3138  // iopt = 5; fills with nentries in the bin
3139 
3140 
3141  //std::cout << "In fillGaussianMeanOrWidth for " << h->GetName() << std::endl;
3142 
3143  //calling this means that the histogram bin content is flagged
3144  //as being an average and so adding histos from different jobs
3145  //will produce weighted mean
3146  h->SetBit(TH1::kIsAverage);
3147 
3148  int nbins_2d = h2d->GetNbinsX();
3149  int nbins_y = h2d->GetNbinsY();
3150  // Removed by Alex
3151  //int nbins_h = h->GetNbinsX();
3152  //if(nbins_2d!=nbins_h) std::cout << "Mean/Width Histograms not set up correctly - nbins mismatch for " <<
3153  // h->GetName() << std::endl;
3154 
3155  // Check if nbins_y is less than 1 and skip if true
3156  if (nbins_y <= 1) {
3157  return;
3158  }
3159 
3160  for (int i = 1; i != nbins_2d + 1; i++) {
3161  //std::cout << "Gaussian: processing bin " << i << std::endl;
3162 
3163  TH1F* hproj = (TH1F*) h2d->ProjectionY("proj", i, i, "e");
3164 
3165  //std::cout << "Gaussian: made projection for bin " << i << std::endl;
3166 
3167  //do not fill if there are few entries in the bin
3168  if (iopt < 5 && (hproj->GetEntries() <= 30 || hproj->Integral() <= 30)) {
3169  delete hproj;
3170  //h->SetBinContent(i,j,0);
3171  //h->SetBinError(i,j,0);
3172  continue;
3173  }
3174 
3175  if (iopt == 0) {
3176  h->SetBinContent(i, hproj->GetMean());
3177  h->SetBinError(i, hproj->GetMeanError());
3178  } else if (iopt == 1) {
3179  h->SetBinContent(i, hproj->GetRMS());
3180  h->SetBinError(i, hproj->GetRMSError());
3181  } else if (iopt >= 2 && iopt < 5) {
3182  //we make a 2-stage Gaussian fit
3183  //first fit is in the range [MEAN + 2*RMS, MEAN - 2*RMS]
3184  //(restricting the range of the first fit has little effect)
3185  //second fit is in the range [mean + 2*width, mean - 2*width]
3186  //using the mean and width of the first fit
3187 
3188  //first fit
3189  float mean = hproj->GetMean();
3190  float rms = hproj->GetRMS();
3191  float min = mean - 2 * rms;
3192  float max = mean + 2 * rms;
3193  TF1* fW = new TF1("fW", "gaus", min, max);
3194  hproj->Fit("fW", "RQN");
3195 
3196  //second fit
3197  mean = fW->GetParameter(1);
3198  rms = fW->GetParameter(2);
3199  min = mean - 2 * rms;
3200  max = mean + 2 * rms;
3201  //if bins are large relative to distribution then
3202  //the above determined range could only be two bins
3203  //or even just fractions of bins
3204  //in this case a gauus fit is meaningless, and can have strange
3205  //chi2 behaviour and large errors on the mean
3206  //therefore make sure we are including full bins in fit and
3207  //have a minimum of 3 bins
3208  int minBin = hproj->FindBin(min);
3209  int maxBin = hproj->FindBin(max);
3210  if (maxBin - minBin < 2) {
3211  //require at least 3 bins for a meaningful gauss fit
3212  //std::cout << "WARNING core had too few bins for fit - expanding core for " << h->GetName() << std::endl;
3213  maxBin = maxBin + 1;
3214  minBin = minBin - 1;
3215  }
3216  min = hproj->GetBinLowEdge(minBin);
3217  max = (hproj->GetBinLowEdge(maxBin)) + (hproj->GetBinWidth(maxBin));
3218 
3219  TF1* fW2 = new TF1("fW2", "gaus", min, max);
3220  hproj->Fit("fW2", "RQN");
3221  if (iopt == 2) {
3222  h->SetBinContent(i, fW2->GetParameter(1));
3223  h->SetBinError(i, fW2->GetParError(1));
3224  } else if (iopt == 3) {
3225  h->SetBinContent(i, fW2->GetParameter(2));
3226  h->SetBinError(i, fW2->GetParError(2));
3227  } else if (iopt == 4) {
3228  float chi2 = fW2->GetChisquare();
3229  int ndf = fW2->GetNDF();
3230  if (ndf) h->SetBinContent(i, chi2 / ndf);
3231  else h->SetBinContent(i, 0);
3232  }
3233  delete fW;
3234  delete fW2;
3235  } else if (iopt == 5) {
3236  h->SetBinContent(i, hproj->GetEntries());
3237  }
3238  //else std::cerr << "Incorrect iopt switch in meanRMSProjections2D()" << std::endl;
3239 
3240  delete hproj;
3241  }
3242 
3243 
3244  return;
3245  }

◆ meanRMSProjections3D()

void dqutils::MonitoringFile::meanRMSProjections3D ( TH3F *  h3d,
TH2F *  h,
int  iopt 
)
static

Definition at line 3247 of file MonitoringFile_IDAlignPostProcess.cxx.

3248  {
3249  //fills a 2-D histogram with mean or width of the distribution for each bin in a 3D histogram
3250  //the way in which the mean or width is determined is specified by the iopt option
3251  //can be from a gaussian fit for example
3252  // iopt = 0; fills with statistical mean
3253  // iopt = 1; fills with statistical RMS
3254  // iopt = 2; fills with mean of a two-stage Gaussian fit
3255  // iopt = 3; fills with width of a two-stage Gaussian fit
3256  // iopt = 4; fills with Chi2/DOF of a two-stage Gaussian fit
3257  // iopt = 5; fills with nentries in the bin
3258 
3259  int nbins_3dX = h3d->GetNbinsX();
3260  int nbins_3dY = h3d->GetNbinsY();
3261  int nbins_hX = h->GetNbinsX();
3262  int nbins_hY = h->GetNbinsY();
3263 
3264  // Check if nbins_3dZ is less than 1 and skip if true
3265  if (h3d->GetZaxis()->GetNbins() <= 1) {
3266  return;
3267  }
3268 
3269  if (nbins_3dX != nbins_hX) {
3270  std::cout << "meanRMSProjections3D: Mean/RMS Histograms not set up correctly - nbins mismatch for " <<
3271  h->GetName() << std::endl;
3272  return;
3273  }
3274  if (nbins_3dY != nbins_hY) {
3275  std::cout << "meanRMSProjections3D: Mean/RMS Histograms not set up correctly - nbins mismatch for " <<
3276  h->GetName() << std::endl;
3277  return;
3278  }
3279 
3280  for (int i = 1; i != nbins_3dX + 1; i++) {
3281  for (int j = 1; j != nbins_3dY + 1; j++) {
3282  TH1F* hproj = (TH1F*) h3d->ProjectionZ("proj", i, i, j, j, "e");
3283 
3284  //You can use this piece of code as snippet in order to produce fancy single modules residuals.
3285  //TCanvas Canvas;
3286  //std::string eta_mod="",phi_mod="";
3287  //std::string histoName = h3d->GetName();
3288  //if (histoName.find("pix_b0") == std::string::npos)
3289  //continue;
3290  //std::ostringstream convert_eta,convert_phi; // stream used for the conversion
3291  //convert_eta << i;
3292  //convert_phi << j;
3293  //eta_mod = convert_eta.str();
3294  //phi_mod = convert_phi.str();
3295  //Canvas.cd();
3296  //hproj->DrawClone();
3297 
3298  //Canvas.SaveAs((histoName+"_"+eta_mod+"_"+phi_mod+".pdf").c_str());
3299 
3300  //do not fill if there are 30 or less entries in the bin
3301  if (iopt < 5 && (hproj->GetEntries() <= 30 || hproj->Integral() <= 30)) {
3302  delete hproj;
3303  //h->SetBinContent(i,j,0);
3304  //h->SetBinError(i,j,0);
3305  continue;
3306  }
3307  if (iopt == 0) {
3308  h->SetBinContent(i, j, hproj->GetMean());
3309  h->SetBinError(i, j, hproj->GetMeanError());
3310  } else if (iopt == 1) {
3311  h->SetBinContent(i, j, hproj->GetRMS());
3312  h->SetBinError(i, j, hproj->GetRMSError());
3313  } else if (iopt >= 2 && iopt < 5) {
3314  //we make a 2-stage Gaussian fit
3315  //first fit is in the range [MEAN + 2*RMS, MEAN - 2*RMS]
3316  //(restricting the range of the first fit has little effect)
3317  //second fit is in the range [mean + 2*width, mean - 2*width]
3318  //using the mean and width of the first fit
3319 
3320  //first fit
3321  float mean = hproj->GetMean();
3322  float rms = hproj->GetRMS();
3323  float min = mean - 2 * rms;
3324  float max = mean + 2 * rms;
3325  TF1* fW = new TF1("fW", "gaus", min, max);
3326  hproj->Fit("fW", "RQN");
3327 
3328  //second fit
3329  mean = fW->GetParameter(1);
3330  rms = fW->GetParameter(2);
3331  min = mean - 2 * rms;
3332  max = mean + 2 * rms;
3333  //if bins are large relative to distribution then
3334  //the above determined range could only be two bins
3335  //or even just fractions of bins
3336  //in this case a gauus fit is meaningless, and can have strange
3337  //chi2 behaviour and large errors on the mean
3338  //therefore make sure we are including full bins in fit and
3339  //have a minimum of 3 bins
3340  int minBin = hproj->FindBin(min);
3341  int maxBin = hproj->FindBin(max);
3342  if (maxBin - minBin < 2) {
3343  //require at least 3 bins for a meaningful gauss fit
3344  //std::cout << "WARNING core had too few bins for fit - expanding core for " << h->GetName() << std::endl;
3345  maxBin = maxBin + 1;
3346  minBin = minBin - 1;
3347  }
3348  min = hproj->GetBinLowEdge(minBin);
3349  max = (hproj->GetBinLowEdge(maxBin)) + (hproj->GetBinWidth(maxBin));
3350 
3351  TF1* fW2 = new TF1("fW2", "gaus", min, max);
3352  hproj->Fit("fW2", "RQN");
3353  if (iopt == 2) {
3354  h->SetBinContent(i, j, fW2->GetParameter(1));
3355  h->SetBinError(i, j, fW2->GetParError(1));
3356  } else if (iopt == 3) {
3357  h->SetBinContent(i, j, fW2->GetParameter(2));
3358  h->SetBinError(i, j, fW2->GetParError(2));
3359  } else if (iopt == 4) {
3360  float chi2 = fW2->GetChisquare();
3361  int ndf = fW2->GetNDF();
3362  if (ndf) h->SetBinContent(i, j, chi2 / ndf);
3363  else h->SetBinContent(i, j, 0);
3364  }
3365 
3366  delete fW;
3367  delete fW2;
3368  } else if (iopt == 5) {
3369  h->SetBinContent(i, j, hproj->GetEntries());
3370  }
3371  //else std::cerr << "Incorrect iopt switch in meanRMSProjections3D()" << std::endl;
3372  delete hproj;
3373  }
3374  }
3375 
3376  return;
3377  }

◆ meanRMSProjections3D_DMRPlot()

void dqutils::MonitoringFile::meanRMSProjections3D_DMRPlot ( TH3F *  h3d,
TH1F *  h,
int  iopt 
)
static

Definition at line 3379 of file MonitoringFile_IDAlignPostProcess.cxx.

3380  {
3381  //fills a 1-D histogram with the mean or width of the distribution for each bin in a 3D histogram
3382  //the way in which the mean or width is determined is specified by the iopt option
3383  //can be from a gaussian fit for example
3384  // iopt = 0; fills with statistical mean
3385  // iopt = 1; fills with statistical RMS
3386  // iopt = 2; fills with mean of a two-stage Gaussian fit
3387  // iopt = 3; fills with width of a two-stage Gaussian fit
3388  // iopt = 4; fills with Chi2/DOF of a two-stage Gaussian fit
3389  // iopt = 5; fills with the error on the fitted mean
3390  // iopt = 6; fills with statistical median
3391  // iopt = 7; fills with nentries in the bin
3392 
3393  int nbins_3dX = h3d->GetNbinsX();
3394  int nbins_3dY = h3d->GetNbinsY();
3395 
3396  // Check if nbins_3dZ is less than 1 and skip if true
3397  if (h3d->GetZaxis()->GetNbins() <= 1) {
3398  return;
3399  }
3400 
3401  for (int i = 1; i != nbins_3dX + 1; i++) {
3402  for (int j = 1; j != nbins_3dY + 1; j++) {
3403  TH1F* hproj = (TH1F*) h3d->ProjectionZ("proj", i, i, j, j, "e");
3404 
3405  //do not fill if there are 30 or less entries in the bin
3406  if (iopt < 7 && (hproj->GetEntries() <= 30 || hproj->Integral() <= 30)) {
3407  delete hproj;
3408  continue;
3409  }
3410  if (iopt == 0) {
3411  h->Fill(hproj->GetMean());
3412  } else if (iopt == 1) {
3413  h->Fill(hproj->GetRMS());
3414  } else if (iopt >= 2 && iopt < 6) {
3415  //we make a 2-stage Gaussian fit
3416  //first fit is in the range [MEAN + 2*RMS, MEAN - 2*RMS]
3417  //(restricting the range of the first fit has little effect)
3418  //second fit is in the range [mean + 2*width, mean - 2*width]
3419  //using the mean and width of the first fit
3420 
3421  //first fit
3422  float mean = hproj->GetMean();
3423  float rms = hproj->GetRMS();
3424  float min = mean - 2 * rms;
3425  float max = mean + 2 * rms;
3426  TF1* fW = new TF1("fW", "gaus", min, max);
3427  hproj->Fit("fW", "RQN");
3428 
3429  //second fit
3430  mean = fW->GetParameter(1);
3431  rms = fW->GetParameter(2);
3432  min = mean - 2 * rms;
3433  max = mean + 2 * rms;
3434  //if bins are large relative to distribution then
3435  //the above determined range could only be two bins
3436  //or even just fractions of bins
3437  //in this case a gauus fit is meaningless, and can have strange
3438  //chi2 behaviour and large errors on the mean
3439  //therefore make sure we are including full bins in fit and
3440  //have a minimum of 3 bins
3441  int minBin = hproj->FindBin(min);
3442  int maxBin = hproj->FindBin(max);
3443  if (maxBin - minBin < 2) {
3444  //require at least 3 bins for a meaningful gauss fit
3445  //std::cout << "WARNING core had too few bins for fit - expanding core for " << h->GetName() << std::endl;
3446  maxBin = maxBin + 1;
3447  minBin = minBin - 1;
3448  }
3449  min = hproj->GetBinLowEdge(minBin);
3450  max = (hproj->GetBinLowEdge(maxBin)) + (hproj->GetBinWidth(maxBin));
3451 
3452  TF1* fW2 = new TF1("fW2", "gaus", min, max);
3453  hproj->Fit("fW2", "RQN");
3454  if (iopt == 2) {
3455  h->Fill(fW2->GetParameter(1));
3456  } else if (iopt == 3) {
3457  h->Fill(fW2->GetParameter(2));
3458  } else if (iopt == 4) {
3459  float chi2 = fW2->GetChisquare();
3460  int ndf = fW2->GetNDF();
3461  if (ndf) h->Fill(chi2 / ndf);
3462  else h->Fill(0.0);
3463  } else if (iopt == 5) {
3464  h->Fill(fW2->GetParError(1));
3465  }
3466 
3467  delete fW;
3468  delete fW2;
3469  } else if (iopt == 6) {
3470  h->Fill(getMedian(hproj));
3471  } else if (iopt == 7) {
3472  h->Fill(hproj->GetEntries());
3473  }
3474  //else std::cerr << "Incorrect iopt switch in meanRMSProjections3D_DMRPlot()" << std::endl;
3475  delete hproj;
3476  }
3477  }
3478 
3479  return;
3480  }

◆ meanRMSProjections3D_XY()

void dqutils::MonitoringFile::meanRMSProjections3D_XY ( TH3F *  h3d,
TH1F *  h,
int  iXY,
int  iopt 
)
static

Definition at line 3482 of file MonitoringFile_IDAlignPostProcess.cxx.

3483  {
3484  //fills a 1-D histogram with mean or width of the projected rows/columns of a 3-D histogram
3485  // iXY = 0; project columns (i.e. for each x of the 3D histogram form the distribution of all y-bins)
3486  // iXY = 1; project rows (i.e. for each y of the 3D histogram form the distribution of all x-bins)
3487  //the way in which the mean or width is determined is specified by the iopt option
3488  //can be from a gaussian fit for example
3489  // iopt = 0; fills with statistical mean
3490  // iopt = 1; fills with statistical RMS
3491  // iopt = 2; fills with mean of a two-stage Gaussian fit
3492  // iopt = 3; fills with width of a two-stage Gaussian fit
3493  // iopt = 4; fills with Chi2/DOF of a two-stage Gaussian fit
3494  // iopt = 5; fills with nentries in the bin
3495 
3496  int nbins_3dX = h3d->GetNbinsX();
3497  int nbins_3dY = h3d->GetNbinsY();
3498  int nbins_h = h->GetNbinsX();
3499  int nbins_3d = 0;//will be overridden
3500 
3501  // Check if nbins_3dZ is less than 1 and skip if true
3502  if (h3d->GetZaxis()->GetNbins()<= 1) {
3503  return;
3504  }
3505 
3506  if (iXY == 0) {
3507  if (nbins_3dX != nbins_h) {
3508  std::cerr << "meanRMSProjections3D_XY: Mean/RMS Histograms not set up correctly - nbins mismatch for " <<
3509  h->GetName() << std::endl;
3510  return;
3511  }
3512  nbins_3d = nbins_3dX;
3513  } else if (iXY == 1) {
3514  if (nbins_3dY != nbins_h) {
3515  std::cerr << "meanRMSProjections3D_XY: Mean/RMS Histograms not set up correctly - nbins mismatch for" <<
3516  h->GetName() << std::endl;
3517  std::cout << "nbins_3dY = " << nbins_3dY << ", nbins_h = " << nbins_h << std::endl;
3518  return;
3519  }
3520  nbins_3d = nbins_3dY;
3521  } else {
3522  //std::cerr << "meanRMSProjections3D_XY: iXY != 1 or 0 exiting" << std::endl;
3523  return;
3524  }
3525 
3526  for (int i = 1; i != nbins_3d + 1; i++) {
3527  TH1F* hproj;
3528  if (iXY == 0) {
3529  h3d->GetXaxis()->SetRange(i, i);
3530  h3d->GetYaxis()->SetRange(1, nbins_3dY);
3531  hproj = (TH1F*) h3d->Project3D("ze");
3532  } else { // (iXY == 1), as checked above
3533  h3d->GetYaxis()->SetRange(i, i);
3534  h3d->GetXaxis()->SetRange(1, nbins_3dX);
3535  hproj = (TH1F*) h3d->Project3D("ze");
3536  }
3537 
3538  //do not fill if there are 30 or less entries in the bin
3539  if (iopt < 5 && (hproj->GetEntries() <= 30 || hproj->Integral() <= 30)) {
3540  delete hproj;
3541  //h->SetBinContent(i,0);
3542  //h->SetBinError(i,0);
3543  continue;
3544  }
3545  if (iopt == 0) {
3546  h->SetBinContent(i, hproj->GetMean());
3547  h->SetBinError(i, hproj->GetMeanError());
3548  } else if (iopt == 1) {
3549  h->SetBinContent(i, hproj->GetRMS());
3550  h->SetBinError(i, hproj->GetRMSError());
3551  } else if (iopt >= 2 && iopt < 5) {
3552  //we make a 2-stage Gaussian fit
3553  //first fit is in the range [MEAN + 2*RMS, MEAN - 2*RMS]
3554  //(restricting the range of the first fit has little effect)
3555  //second fit is in the range [mean + 2*width, mean - 2*width]
3556  //using the mean and width of the first fit
3557 
3558  //first fit
3559  float mean = hproj->GetMean();
3560  float rms = hproj->GetRMS();
3561  float min = mean - 2 * rms;
3562  float max = mean + 2 * rms;
3563  TF1* fW = new TF1("fW", "gaus", min, max);
3564  hproj->Fit("fW", "RQN");
3565 
3566  //second fit
3567  mean = fW->GetParameter(1);
3568  rms = fW->GetParameter(2);
3569  min = mean - 2 * rms;
3570  max = mean + 2 * rms;
3571  //if bins are large relative to distribution then
3572  //the above determined range could only be two bins
3573  //or even just fractions of bins
3574  //in this case a gauus fit is meaningless, and can have strange
3575  //chi2 behaviour and large errors on the mean
3576  //therefore make sure we are including full bins in fit and
3577  //have a minimum of 3 bins
3578  int minBin = hproj->FindBin(min);
3579  int maxBin = hproj->FindBin(max);
3580  if (maxBin - minBin < 2) {
3581  //require at least 3 bins for a meaningful gauss fit
3582  //std::cout << "WARNING core had too few bins for fit - expanding core for " << h->GetName() << std::endl;
3583  maxBin = maxBin + 1;
3584  minBin = minBin - 1;
3585  }
3586  min = hproj->GetBinLowEdge(minBin);
3587  max = (hproj->GetBinLowEdge(maxBin)) + (hproj->GetBinWidth(maxBin));
3588 
3589  TF1* fW2 = new TF1("fW2", "gaus", min, max);
3590  hproj->Fit("fW2", "RQN");
3591  if (iopt == 2) {
3592  h->SetBinContent(i, fW2->GetParameter(1));
3593  h->SetBinError(i, fW2->GetParError(1));
3594  } else if (iopt == 3) {
3595  h->SetBinContent(i, fW2->GetParameter(2));
3596  h->SetBinError(i, fW2->GetParError(2));
3597  } else if (iopt == 4) {
3598  float chi2 = fW2->GetChisquare();
3599  int ndf = fW2->GetNDF();
3600  if (ndf) h->SetBinContent(i, chi2 / ndf);
3601  else h->SetBinContent(i, 0);
3602  }
3603  delete fW;
3604  delete fW2;
3605  } else if (iopt == 5) {
3606  h->SetBinContent(i, hproj->GetEntries());
3607  }
3608  //else std::cerr << "Incorrect iopt switch in meanRMSProjections3D_XY()" << std::endl;
3609  delete hproj;
3610  }
3611 
3612 
3613  return;
3614  }

◆ merge_effAsPerCent()

void dqutils::MonitoringFile::merge_effAsPerCent ( TH2 &  a,
const TH2 &  b 
)
static

Definition at line 64 of file MonitoringFile_MergeAlgs.cxx.

64  {
65  // Auther: Benjamin Trocme
66  // a and b are efficiency histogramming with percentage stored
67  // den/num are a number of events
68  // BinContent = n/d*100
69  // BinError = (1/d2) * sqrt( d*n*(d-n) )
70 
71  // First extract the denominator
72  // It is supposed to be the same for all bins
73  // Have to do this in two steps to avoid problem
74  // of empty bins in which the nb of events can not be extracted
75  float denA = 0.;
76  float denB = 0.;
77 
78  for (int ix = 1; ix <= a.GetNbinsX(); ix++) {
79  for (int iy = 1; iy <= a.GetNbinsY(); iy++) {
80  // Extract ratio and associated errors
81  // Warning : these are percentages!
82  float efficiencyA = a.GetBinContent(ix, iy) / 100.;
83  float efficiencyB = b.GetBinContent(ix, iy) / 100.;
84  float efficiencyErrA = a.GetBinError(ix, iy) / 100.;
85  float efficiencyErrB = b.GetBinError(ix, iy) / 100.;
86 
87  // Compute denominator ("nb of events")
88  if (efficiencyErrA != 0 && efficiencyA != 0 &&
89  denA == 0) denA = efficiencyA * (1 - efficiencyA) / efficiencyErrA / efficiencyErrA;
90  if (efficiencyErrB != 0 && efficiencyB != 0 &&
91  denB == 0) denB = efficiencyB * (1 - efficiencyB) / efficiencyErrB / efficiencyErrB;
92  }
93  }
94 
95  float denTot = denA + denB;
96  const double nEntries = a.GetEntries() + b.GetEntries();
97 
98  for (int ix = 1; ix <= a.GetNbinsX(); ix++) {
99  for (int iy = 1; iy <= a.GetNbinsY(); iy++) {
100  // Extract ratio and associated errors
101  // Warning : these are percentages!
102  float efficiencyA = a.GetBinContent(ix, iy) / 100.;
103  float efficiencyB = b.GetBinContent(ix, iy) / 100.;
104  //float efficiencyErrA = a.GetBinError(ix,iy)/100.;
105  //float efficiencyErrB = b.GetBinError(ix,iy)/100.;
106 
107  // Compute numerator ("nb of good events") for each histo
108  float numA = denA * efficiencyA;
109  float numB = denB * efficiencyB;
110 
111  // Deduce the merged ratio and the associated error
112  float numTot = numA + numB;
113  float efficiencyTot = 0.;
114  float efficiencyErrTot = 0.;
115 
116  if (denTot != 0.) efficiencyTot = numTot / denTot * 100.;
117  if (denTot != 0.) efficiencyErrTot = sqrt(numTot * denTot * (denTot - numTot)) / denTot / denTot * 100.;
118 
119  a.SetBinContent(ix, iy, efficiencyTot);
120  a.SetBinError(ix, iy, efficiencyErrTot);
121  }
122  }
123  a.SetEntries(nEntries);
124  }

◆ merge_effAsPerCentAlt()

void dqutils::MonitoringFile::merge_effAsPerCentAlt ( TH1 &  a,
const TH1 &  b 
)
static

Definition at line 212 of file MonitoringFile_MergeAlgs.cxx.

212  {
213  // Author: Peter Onyisi, d'apres Benjamin Trocme
214  // Variation of merge_effAsPerCent
215  // a and b are efficiency histogramming with percentage stored
216  // den/num are a number of events
217  // BinContent = n/d*100
218  // BinError = (1/d2) * sqrt( d*n*(d-n) )
219 
220  // Verify histogram compatibility
221  if (a.GetDimension() != b.GetDimension()) {
222  std::cerr << "merge_effAsPerCentAlt \"" << a.GetName() <<
223  "\": attempt to merge histograms of different dimensionality\n";
224  return;
225  }
226 
227  Int_t ncells = getNumBins(a);
228 
229  if (ncells != getNumBins(b)) {
230  std::cerr << "merge_effAsPerCentAlt \"" << a.GetName() <<
231  "\": attempt to merge histograms of different bin counts\n";
232  return;
233  }
234 
235  // do not attempt to automatically extend!
236  a.SetCanExtend(TH1::kNoAxis);
237 
238  // First extract the denominator
239  // It is supposed to be the same for all bins
240  // Have to do this in two steps to avoid problem
241  // of empty bins in which the nb of events can not be extracted
242 
243  float denA = 0.;
244  float denB = 0.;
245  for (int bin = 0; bin < ncells; bin++) {
246  if (IsBinUnderflow(a, bin) || IsBinOverflow(a, bin)) continue;
247  // Extract ratio and associated errors
248  // Warning : these are percentages!
249  float efficiencyA = a.GetBinContent(bin) / 100.;
250  float efficiencyB = b.GetBinContent(bin) / 100.;
251  float efficiencyErrA = a.GetBinError(bin) / 100.;
252  float efficiencyErrB = b.GetBinError(bin) / 100.;
253 
254  // Compute denominator ("nb of events")
255  if (efficiencyErrA != 0 && efficiencyA != 0 &&
256  denA == 0) denA = efficiencyA * (1 - efficiencyA) / efficiencyErrA / efficiencyErrA;
257  if (efficiencyErrB != 0 && efficiencyB != 0 && denB == 0) denB = efficiencyB * (1 - efficiencyB) / efficiencyErrB / efficiencyErrB;
258  }
259 
260  float denTot = denA + denB;
261  const double nEntries = a.GetEntries() + b.GetEntries();
262 
263  for (int bin = 0; bin < ncells; bin++) {
264  if (IsBinUnderflow(a, bin) || IsBinOverflow(a, bin)) continue;
265  // Extract ratio and associated errors
266  // Warning : these are percentages!
267  float efficiencyA = a.GetBinContent(bin) / 100.;
268  float efficiencyB = b.GetBinContent(bin) / 100.;
269  //float efficiencyErrA = a.GetBinError(bin)/100.;
270  //float efficiencyErrB = b.GetBinError(bin)/100.;
271 
272  // Compute numerator ("nb of good events") for each histo
273  float numA = denA * efficiencyA;
274  float numB = denB * efficiencyB;
275 
276  // Deduce the merged ratio and the associated error
277  float numTot = numA + numB;
278  float efficiencyTot = 0.;
279  float efficiencyErrTot = 0.;
280 
281  if (denTot != 0.) efficiencyTot = numTot / denTot * 100.;
282  if (denTot != 0.) efficiencyErrTot = sqrt(numTot * denTot * (denTot - numTot)) / denTot / denTot * 100.;
283 
284  a.SetBinContent(bin, efficiencyTot);
285  a.SetBinError(bin, efficiencyErrTot);
286  }
287  a.SetEntries(nEntries);
288  }

◆ merge_eventSample()

void dqutils::MonitoringFile::merge_eventSample ( TH2 &  a,
const TH2 &  b 
)
static

Definition at line 497 of file MonitoringFile_MergeAlgs.cxx.

497  {
498  // Author: Peter Faulkner
499  // Merge histograms containing, for example, event numbers of events
500  // with particular types of errors. Data is inserted/appended row-wise.
501  int nbinsx = a.GetNbinsX();
502  int nbinsy = a.GetNbinsY();
503 
504  if (b.GetNbinsX() != nbinsx || b.GetNbinsY() != nbinsy) return;
505 
506  double entries = a.GetEntries();
507  for (int biny = 1; biny <= nbinsy; biny++) {
508  for (int binx = 1; binx <= nbinsx; binx++) {
509  double bVal = b.GetBinContent(binx, biny);
510  if (bVal == 0) break;
511  for (int binxa = 1; binxa <= nbinsx; binxa++) {
512  double aVal = a.GetBinContent(binxa, biny);
513  if (aVal == 0) {
514  a.SetBinContent(binxa, biny, bVal);
515  entries++;
516  break;
517  } else if (bVal < aVal) {
518  for (int bx = nbinsx; bx > binxa; bx--) {
519  double v1 = a.GetBinContent(bx - 1, biny);
520  if (v1 == 0) continue;
521  double v2 = a.GetBinContent(bx, biny);
522  if (v2 == 0) entries++;
523  a.SetBinContent(bx, biny, v1);
524  }
525  a.SetBinContent(binxa, biny, bVal);
526  break;
527  } else if (aVal == bVal) break;
528  }
529  }
530  }
531  a.SetEntries(entries);
532  }

◆ merge_identical()

void dqutils::MonitoringFile::merge_identical ( TH1 &  a,
const TH1 &  b 
)
static

Definition at line 694 of file MonitoringFile_MergeAlgs.cxx.

694  {
695  // Merge "status" histograms, i.e filled at start of run/LB.
696  // The histogram title should contain the LB for which the histo was filled
697  // such that strcmp can extract the histo of lower LB
698  // Be careful to not format your title with %d but rather %4d. Otherwise,
699  // strcmp will return : 2>10
700  // Example in : LArCalorimeter/LArMonTools/src/LArCoverage.cxx
701  // Author: B.Trocme
702  //
703 
704  if (a.GetDimension() != b.GetDimension()) {
705  std::cerr << "merge_identical \"" << a.GetName() << "\": attempt to merge histograms of different dimensionality\n";
706  return;
707  }
708 
709  Int_t ncells = getNumBins(a);
710 
711  if (ncells != getNumBins(b)) {
712  std::cerr << "merge_identical \"" << a.GetName() << "\": attempt to merge histograms of different sizes\n";
713  return;
714  }
715 
716  // check that all bins contentsl are identical
717  for (Int_t icell = 0; icell < ncells; ++icell) {
718  if ((a.GetBinContent(icell) != b.GetBinContent(icell))
719  || (a.GetBinError(icell) != b.GetBinError(icell))) {
720  std::cerr << "merge_identical \"" << a.GetName() << "\" and \"" << b.GetName() << "\" have different content\n";
721  return;
722  }
723  }
724 
725  return;
726  }

◆ merge_lowerLB()

void dqutils::MonitoringFile::merge_lowerLB ( TH1 &  a,
const TH1 &  b 
)
static

Definition at line 647 of file MonitoringFile_MergeAlgs.cxx.

647  {
648  // Merge "status" histograms, i.e filled at start of run/LB.
649  // The histogram title should contain the LB for which the histo was filled
650  // such that strcmp can extract the histo of lower LB
651  // Be careful to not format your title with %d but rather %4d. Otherwise,
652  // strcmp will return : 2>10
653  // Example in : LArCalorimeter/LArMonTools/src/LArCoverage.cxx
654  // Author: B.Trocme
655  //
656 
657  if (a.GetDimension() != b.GetDimension()) {
658  std::cerr << "merge_lowerLB \"" << a.GetName() << "\": attempt to merge histograms of different dimensionality\n";
659  return;
660  }
661 
662  Int_t ncells = getNumBins(a);
663 
664  if (ncells != getNumBins(b)) {
665  std::cerr << "merge_lowerLB \"" << a.GetName() << "\": attempt to merge histograms of different sizes\n";
666  return;
667  }
668 
669  // do not attempt to automatically extend!
670  a.SetCanExtend(TH1::kNoAxis);
671 
672  if (strcmp(a.GetTitle(), b.GetTitle()) > 0) {
673  // The LB of histo a is greater than the LB of histo b
674  // a is overwritten by b - Otherwise do nothing
675  a.SetTitle(b.GetTitle());
676  /*
677  for( int bin = 0; bin < ncells; bin++ ) {
678  a.SetBinContent(bin,b.GetBinContent(bin));
679  a.SetBinError(bin,b.GetBinError(bin));
680  }
681  */
682  a.Add(&a, &b, 0, 1);
683  // If the original histo did not contain sumw2, delete the sumw2 array created
684  // by SetBinError. This may look dirty but this is the recommandation by R.Brun:
685  // http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=1620&p=51674&hilit=sumw2#p51674
686  /*
687  if ((b.GetSumw2N()) == 0) (a.GetSumw2())->Set(0);
688 
689  a.SetEntries(b.GetEntries()); */
690  }
691  return;
692  }

◆ merge_perBinEffPerCent()

void dqutils::MonitoringFile::merge_perBinEffPerCent ( TH1 &  a,
const TH1 &  b 
)
static

Definition at line 126 of file MonitoringFile_MergeAlgs.cxx.

126  {
127  // This code assume that the histogram content is the efficiency of a
128  // given cut or selection in each bin (e.g. the ratio of a distribution
129  // after cut to the distribution before cut, bin by bin) and that these
130  // are efficiencies in percent.
131  //
132  // It also assumes that the error we calculated in a specific way:
133  // dEff = sqrt( eff*(1.-eff)/N ) [Eff= efficiency N = number of event in bin before cuts]
134  // dEff = 1-0.159^(1/N) if Eff = 0
135  // dEff = 1-0.159^(1/N) if Eff = 1
136  // dEff = 0 means no entries, the bin is ignored
137  //
138 
139  constexpr double OneSigOneSided = 0.159; // 0.5*(1-0.681) where 0.681 means 68%CL
140 
141  // Verify histogram compatibility
142  if (a.GetDimension() != b.GetDimension()) {
143  std::cerr << "merge_perBinEffPerCent \"" << a.GetName() <<
144  "\": attempt to merge histograms of different dimensionality" << std::endl;
145  return;
146  }
147 
148  Int_t ncells = getNumBins(a);
149 
150  if (ncells != getNumBins(b)) {
151  std::cerr << "merge_perBinEffPerCent \"" << a.GetName() << "\": attempt to merge histograms of different sizes\n";
152  return;
153  }
154 
155  // do not attempt to automatically extend!
156  a.SetCanExtend(TH1::kNoAxis);
157 
158  const double nEntries = a.GetEntries() + b.GetEntries();
159 
160  for (int bin = 0; bin < ncells; bin++) {
161  if (IsBinUnderflow(a, bin) || IsBinOverflow(a, bin)) continue;
162  float efficiencyA = a.GetBinContent(bin) / 100.;
163  float efficiencyB = b.GetBinContent(bin) / 100.;
164  float efficiencyErrA = a.GetBinError(bin) / 100.;
165  float efficiencyErrB = b.GetBinError(bin) / 100.;
166 
167  float efficiencyTot = 0.;
168  float efficiencyErrTot = 0.;
169  if (efficiencyErrA == 0.) {
170  efficiencyTot = efficiencyB;
171  efficiencyErrTot = efficiencyErrB;
172  } else {
173  if (efficiencyErrB == 0.) {
174  efficiencyTot = efficiencyA;
175  efficiencyErrTot = efficiencyErrA;
176  } else {
177  float denomA = 0.;
178  if (efficiencyA == 0.) {
179  denomA = std::log(OneSigOneSided) / std::log(1. - efficiencyErrA);
180  } else {
181  if (efficiencyA > 0.99) {
182  denomA = std::log(OneSigOneSided) / std::log(1. - efficiencyErrA);
183  } else {
184  denomA = efficiencyA * (1. - efficiencyA) / (efficiencyErrA * efficiencyErrA);
185  }
186  }
187 
188  float denomB = 0.;
189  if (efficiencyB == 0.) {
190  denomB = std::log(OneSigOneSided) / std::log(1. - efficiencyErrB);
191  } else {
192  if (efficiencyB > 0.99) {
193  denomB = std::log(OneSigOneSided) / std::log(1. - efficiencyErrB);
194  } else {
195  denomB = efficiencyB * (1. - efficiencyB) / (efficiencyErrB * efficiencyErrB);
196  }
197  }
198 
199  float denom = denomA + denomB;
200  efficiencyTot = (denomA * efficiencyA + denomB * efficiencyB) / denom;
201  efficiencyErrTot = std::sqrt(efficiencyTot * (1. - efficiencyTot) / denom);
202  if (efficiencyTot == 0.) efficiencyErrTot = 1.0 - std::pow(OneSigOneSided, 1.0 / denom);
203  if (efficiencyTot > 0.99) efficiencyErrTot = 1.0 - std::pow(OneSigOneSided, 1.0 / denom);
204  }
205  }
206  a.SetBinContent(bin, efficiencyTot * 100.);
207  a.SetBinError(bin, efficiencyErrTot * 100.);
208  }
209  a.SetEntries(nEntries);
210  }

◆ merge_Rebinned()

void dqutils::MonitoringFile::merge_Rebinned ( TH1 &  a,
TH1 &  b 
)
static

Definition at line 478 of file MonitoringFile_MergeAlgs.cxx.

478  {
479  // Author: Luca Fiorini
480  // This method provide a correct summation for histograms that have different binning
481  // e.g. the histograms with TH1::kCanRebin set to true
482  // The method uses TH1::Merge as explained here:
483  // http://root.cern.ch/root/html/TH1.html#TH1:Merge
484  // The axis x may have different number
485  // of bins and different limits, BUT the largest bin width must be
486  // a multiple of the smallest bin width and the upper limit must also
487  // be a multiple of the bin width.
488 
489  TList* list = new TList;
490 
491  list->Add(&b);
492  a.Merge(list);
493 
494  delete list;
495  }

◆ merge_RMS()

void dqutils::MonitoringFile::merge_RMS ( TH1 &  a,
const TH1 &  b 
)
static

Definition at line 534 of file MonitoringFile_MergeAlgs.cxx.

534  {
535  //Merge histograms where bins are filled with RMS type data:
536  // Add in quadrature, weighted by the number of events as
537  // reconstructed from the errors.
538 
539  // Author: Evan Wulf
540 
541  if (a.GetDimension() != b.GetDimension()) {
542  std::cerr << "merge_RMS \"" << a.GetName() << "\": attempt to merge histograms of different dimensionality\n";
543  return;
544  }
545 
546  Int_t ncells = getNumBins(a);
547 
548  if (ncells != getNumBins(b)) {
549  std::cerr << "merge_RMS \"" << a.GetName() << "\": attempt to merge histograms of different sizes\n";
550  return;
551  }
552 
553  // do not attempt to automatically extend!
554  a.SetCanExtend(TH1::kNoAxis);
555 
556  double nEntries = a.GetEntries();
557  nEntries += b.GetEntries();
558 
559  for (int bin = 0; bin < ncells; bin++) {
560  double rms1 = a.GetBinContent(bin);
561  double rms2 = b.GetBinContent(bin);
562  double e1 = a.GetBinError(bin);
563  double e2 = b.GetBinError(bin);
564 
565  double n1 = 0;
566  double n2 = 0;
567 
568  if (e1 != 0) {
569  n1 = pow(rms1 / e1, 2) / 2;
570  }
571  if (e2 != 0) {
572  n2 = pow(rms2 / e2, 2) / 2;
573  }
574 
575  double ntot = n1 + n2;
576  if (ntot <= 0) {
577  a.SetBinContent(bin, sqrt((rms1 * rms1) + (rms2 * rms2)));
578  a.SetBinError(bin, sqrt((e1 * e1) + (e2 * e2)));
579  } else {
580  double rmstot = sqrt(((pow(n1 * rms1, 2) / (n1 - 1)) + (pow(n2 * rms2, 2) / (n2 - 1))) * (ntot - 1) / pow(ntot, 2));
581  a.SetBinContent(bin, rmstot);
582  a.SetBinError(bin, rmstot / sqrt(2 * ntot));
583  }
584  }
585 
586  a.SetEntries(nEntries);
587  }

◆ merge_RMSpercentDeviation()

void dqutils::MonitoringFile::merge_RMSpercentDeviation ( TH1 &  a,
const TH1 &  b 
)
static

Definition at line 589 of file MonitoringFile_MergeAlgs.cxx.

589  {
590  //Merge histograms where bins are filled with RMS type data which has
591  // been normalized to a percent deviation by use of a reference, using
592  // content = 100 * (RMS - reference) / reference = (RMS * 100 / reference) - 100
593  // error = RMSerror * 100 / reference.
594 
595  // Once constant term (100) is added back in, treatment is the same as with merge_RMS above:
596 
597  // Add in quadrature, weighted by the number of events as
598  // reconstructed from the errors.
599 
600  // Author: Evan Wulf
601 
602  if (a.GetDimension() != b.GetDimension()) {
603  std::cerr << "merge_RMSpercentDeviation \"" << a.GetName() << "\": attempt to merge histograms of different dimensionality\n";
604  return;
605  }
606 
607  Int_t ncells = getNumBins(a);
608 
609  if (ncells != getNumBins(b)) {
610  std::cerr << "merge_RMSpercentDeviation \"" << a.GetName() << "\": attempt to merge histograms of different sizes\n";
611  return;
612  }
613 
614  double nEntries = a.GetEntries();
615  nEntries += b.GetEntries();
616 
617  for (int bin = 0; bin < ncells; bin++) {
618  double y1 = a.GetBinContent(bin) + 100;
619  double y2 = b.GetBinContent(bin) + 100;
620  double e1 = a.GetBinError(bin);
621  double e2 = b.GetBinError(bin);
622 
623  double n1 = 0;
624  double n2 = 0;
625 
626  if (e1 != 0) {
627  n1 = pow(y1 / e1, 2) / 2;
628  }
629  if (e2 != 0) {
630  n2 = pow(y2 / e2, 2) / 2;
631  }
632 
633  double ntot = n1 + n2;
634  if (ntot <= 0) {
635  a.SetBinContent(bin, sqrt((y1 * y1) + (y2 * y2)) - 100);
636  a.SetBinError(bin, sqrt((e1 * e1) + (e2 * e2)));
637  } else {
638  double ytot = sqrt(((pow(n1 * y1, 2) / (n1 - 1)) + (pow(n2 * y2, 2) / (n2 - 1))) * (ntot - 1) / pow(ntot, 2));
639  a.SetBinContent(bin, ytot - 100);
640  a.SetBinError(bin, ytot / sqrt(2 * ntot));
641  }
642  }
643 
644  a.SetEntries(nEntries);
645  }

◆ merge_weightedAverage()

void dqutils::MonitoringFile::merge_weightedAverage ( TH1 &  a,
const TH1 &  b 
)
static

Definition at line 290 of file MonitoringFile_MergeAlgs.cxx.

290  {
291  // Author: Tobias Golling
292 
293  if (a.GetDimension() != b.GetDimension()) {
294  std::cerr << "merge_weightedAverage \"" << a.GetName() << "\": attempt to merge histograms of different dimensionality\n";
295  return;
296  }
297 
298  Int_t ncells = getNumBins(a);
299 
300  if (ncells != getNumBins(b)) {
301  std::cerr << "merge_weightedAverage \"" << a.GetName() << "\": attempt to merge histograms of different sizes\n";
302  return;
303  }
304 
305  // do not attempt to automatically extend!
306  a.SetCanExtend(TH1::kNoAxis);
307 
308  double nEntries = a.GetEntries();
309  nEntries += b.GetEntries();
310 
311  // if ( !a.InheritsFrom("TH2") ) {
312  for (int bin = 0; bin < ncells; bin++) {
313  double y1 = a.GetBinContent(bin);
314  double y2 = b.GetBinContent(bin);
315  double e1 = a.GetBinError(bin);
316  double e2 = b.GetBinError(bin);
317  double w1 = 1., w2 = 1.;
318  if (e1 > 0) w1 = 1. / (e1 * e1);
319  if (e2 > 0) w2 = 1. / (e2 * e2);
320 
321  // case 1:
322  if (e1 > 0 && e2 > 0) {
323  a.SetBinContent(bin, (w1 * y1 + w2 * y2) / (w1 + w2));
324  a.SetBinError(bin, 1. / sqrt(w1 + w2));
325  }
326  // case 2:
327  else if (e2 > 0) {
328  a.SetBinContent(bin, y2);
329  a.SetBinError(bin, e2);
330  }
331  // case 3:
332  else if (e1 > 0) {
333  a.SetBinContent(bin, y1);
334  a.SetBinError(bin, e1);
335  }
336  // case 4:
337  else {
338  a.SetBinContent(bin, (y1 + y2) / 2.);
339  a.SetBinError(bin, 0.);
340  }
341  }
342 
343  a.SetEntries(nEntries);
344 
345  /*
346  } else if ( a.InheritsFrom("TH2") ) {
347 
348  try {
349 
350  merge_weightedAverage2D( dynamic_cast<TH2&>(a), dynamic_cast<const TH2&>(b) );
351 
352  } catch ( const std::bad_cast& err ) {
353  // protect against dynamic cast failing
354 
355  return;
356 
357  }
358 
359  }
360  */
361  }

◆ merge_weightedAverage2D()

void dqutils::MonitoringFile::merge_weightedAverage2D ( TH2 &  a,
const TH2 &  b 
)
static

Definition at line 363 of file MonitoringFile_MergeAlgs.cxx.

363  {
364  // Author: Frank Berghaus
365  for (int binx = 0; binx <= a.GetNbinsX() + 1; binx++) {
366  for (int biny = 0; biny <= a.GetNbinsY() + 1; biny++) {
367  int bin = a.GetBin(binx, biny);
368 
369  double y1 = a.GetBinContent(bin);
370  double y2 = b.GetBinContent(bin);
371  double e1 = a.GetBinError(bin);
372  double e2 = b.GetBinError(bin);
373  double w1 = 1., w2 = 1.;
374  if (e1 > 0) w1 = 1. / (e1 * e1);
375  if (e2 > 0) w2 = 1. / (e2 * e2);
376 
377  // case 1:
378  if (e1 > 0 && e2 > 0) {
379  a.SetBinContent(bin, (w1 * y1 + w2 * y2) / (w1 + w2));
380  a.SetBinError(bin, 1. / sqrt(w1 + w2));
381  }
382  // case 2:
383  else if (e2 > 0) {
384  a.SetBinContent(bin, y2);
385  a.SetBinError(bin, e2);
386  }
387  // case 3:
388  else if (e1 > 0) {
389  a.SetBinContent(bin, y1);
390  a.SetBinError(bin, e1);
391  }
392  // case 4:
393  else {
394  a.SetBinContent(bin, (y1 + y2) / 2.);
395  a.SetBinError(bin, 0.);
396  }
397  }
398  }
399  }

◆ merge_weightedEff()

void dqutils::MonitoringFile::merge_weightedEff ( TH1 &  a,
const TH1 &  b 
)
static

Definition at line 401 of file MonitoringFile_MergeAlgs.cxx.

401  {
402  // Author: Arely Cortes Gonzalez
403  // This function adds two 1D efficiency histograms
404  // weighting them by the number of entries.
405  // The histograms need to have same binning.
406  // Also, it can be used to add two normalized histograms,
407  // keeping the properly weighted normalization.
408  // The number of entries for the merged histogram
409  // will be equal to the NumberEntries of 'a' + NumberEntries of 'b'
410 
411 
412  // Getting weights based on number of entries.
413  double entries_a = a.GetEntries();
414  double entries_b = b.GetEntries();
415 
416  double weight_a = 0.0;
417  double weight_b = 0.0;
418 
419  if (a.GetDimension() != b.GetDimension()) {
420  std::cerr << "merge_weightedEff \"" << a.GetName() << "\": attempt to merge histograms of different dimensionality\n";
421  return;
422  }
423 
424  // Check whether the sumw2 are present - Added by B.Trocme
425  bool sumw2 = (a.GetSumw2N() != 0) && (b.GetSumw2N() != 0);
426 
427  Int_t ncells = getNumBins(a);
428 
429  if (ncells != getNumBins(b)) {
430  std::cerr << "merge_weightedEff \"" << a.GetName() << "\": attempt to merge histograms of different sizes\n";
431  return;
432  }
433 
434  if (entries_b == 0) {
435  // nothing to merge with, return
436  return;
437  }
438  if (entries_a == 0) {
439  // replace my contents with b
440  a.Add(&b);
441  return;
442  }
443 
444  // do not attempt to automatically extend!
445  a.SetCanExtend(TH1::kNoAxis);
446 
447  if (entries_a + entries_b > 0) {
448  weight_a = entries_a / (entries_a + entries_b);
449  weight_b = entries_b / (entries_a + entries_b);
450 
451  for (int bin = 0; bin < ncells; bin++) {
452  double binContent_a = a.GetBinContent(bin);
453  double binContent_b = b.GetBinContent(bin);
454 
455  //Error treatment added by Evan Wulf:
456  //Note that the errors are not used in the calculation!
457  double binError_a = a.GetBinError(bin);
458  double binError_b = b.GetBinError(bin);
459 
460  //Filling the histogram with the new weighted values
461  float weightedEff = binContent_a * weight_a + binContent_b * weight_b;
462  a.SetBinContent(bin, weightedEff);
463 
464  //Set Errors:
465  float weightedError = sqrt(pow(binError_a * weight_a, 2) + pow(binError_b * weight_b, 2));
466  a.SetBinError(bin, weightedError);
467  }
468  }
469  // If the original histos did not contain sumw2, delete the sumw2 array created
470  // by SetBinError. This may look dirty but this is the recommandation by R.Brun:
471  // http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=1620&p=51674&hilit=sumw2#p51674
472  // Added by B.Trocme
473  if (!sumw2) (a.GetSumw2())->Set(0);
474  //Resets number of entries of a:
475  a.SetEntries(entries_a + entries_b);
476  }

◆ mergeDirectory()

void dqutils::MonitoringFile::mergeDirectory ( TDirectory *  outputDir,
const std::vector< TFile * > &  inputFiles,
bool  has_multiple_runs = false,
std::map< TFile *, std::string > *  prefixes = 0 
)

◆ mergeFiles() [1/2]

void dqutils::MonitoringFile::mergeFiles ( const std::string &  outFileName,
const std::string &  listFileName 
)

◆ mergeFiles() [2/2]

void dqutils::MonitoringFile::mergeFiles ( const std::string &  outFileName,
const std::vector< std::string > &  files 
)

◆ mergeLB_createListOfHistos()

static int dqutils::MonitoringFile::mergeLB_createListOfHistos ( TDirectory *  ,
TDirectory *  ,
std::vector< std::string > &  ,
debugLevel_t  
)
staticprivate

◆ mergeLB_processLB()

static int dqutils::MonitoringFile::mergeLB_processLB ( std::vector< TDirectory * > &  ,
std::vector< TDirectory * > &  ,
debugLevel_t  
)
staticprivate

◆ mergeLB_processLBinterval()

static int dqutils::MonitoringFile::mergeLB_processLBinterval ( std::vector< TDirectory * > &  ,
TDirectory *  ,
debugLevel_t  
)
staticprivate

◆ mergeLB_processRun()

static int dqutils::MonitoringFile::mergeLB_processRun ( TDirectory *  ,
debugLevel_t  
)
staticprivate

◆ mergeLB_recursiveDirCopy()

static int dqutils::MonitoringFile::mergeLB_recursiveDirCopy ( TDirectory *  ,
TDirectory *  ,
TDirectory *  ,
std::vector< std::string > &  ,
debugLevel_t  
)
staticprivate

◆ mergeLBintervals()

static int dqutils::MonitoringFile::mergeLBintervals ( const std::string &  ,
const std::string &  debugLevel = "none" 
)
static

◆ mergeObjs()

static int dqutils::MonitoringFile::mergeObjs ( TObject *  ,
TObject *  ,
const std::string &  ,
debugLevel_t  debugLevel = none,
const std::string &  path = "" 
)
staticprivate

◆ mergeObjsMultiCycles()

static void dqutils::MonitoringFile::mergeObjsMultiCycles ( const std::string &  ,
const std::vector< int > &  ,
TDirectory *  ,
const std::string &  ,
std::unique_ptr< TObject > &   
)
staticprivate

◆ MuonTrack_Main()

void dqutils::MonitoringFile::MuonTrack_Main ( const std::string &  inFileName,
TString  dirname 
)
static

finish getting basci information

Definition at line 217 of file MonitoringFile_MuonTrackPostProcess.cxx.

217  {
218  TString plotdirname = dirname;//set the plottting dir anme
219 
220  plotdirname.ReplaceAll("/", "_");//name clean
221  dirname = "MuonPhysics/" + dirname;//give it the full path
222  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
223 
224  if (f == 0) {
225  std::cerr << "MuonTrackMonitoring(): " << "Input file not opened \n";
226  return;
227  }
228  if (f->GetSize() < 1000.) {
229  std::cerr << "MuonTrackMonitoring(): " << "Input file empty \n";
230  return;
231  }
232  // get run directory name
233  //Seemingly unnecessary lines are necessary
234  TIter nextcd0(gDirectory->GetListOfKeys());
235  TKey* key0 = (TKey*) nextcd0();
236  if (key0 == 0) return;
237 
238  TDirectory* dir0 = dynamic_cast<TDirectory*> (key0->ReadObj());
239  if (dir0 == 0) return;
240 
241  dir0->cd();
242  TString runNumber = dir0->GetName();
243  TString motherDir = runNumber + "/" + dirname;
245 
246  //Do the segment part
247  TString mDir = motherDir + "Segments/";
248  if (!f->cd(mDir)) return;
249 
250  TIter nextcd1(gDirectory->GetListOfKeys());
251  while (TKey* key1 = dynamic_cast<TKey*>(nextcd1())) {
252  //While in the segments
253  TString recalg_path = key1->GetName();
254  TString recalg_fullStr = mDir + key1->GetName();
255  TDirectory* dir1 = f->GetDirectory(recalg_fullStr);
256  if (!dir1) continue;
257  dir1->cd();
258 
259  // Divide the efficiency histograms
260  TH2F* h_EffNumerator =
261  (TH2F*) dir1->Get(Form("%sSegments_%s_eff_chamberIndex_perSector_numerator", plotdirname.Data(),
262  recalg_path.Data()));
263  TH2F* h_EffDenominator =
264  (TH2F*) dir1->Get(Form("%sSegments_%s_eff_chamberIndex_perSector_denominator", plotdirname.Data(),
265  recalg_path.Data()));
266  TH2F* h_Efficiency =
267  (TH2F*) dir1->Get(Form("%sSegments_%s_eff_chamberIndex_perSector", plotdirname.Data(), recalg_path.Data()));
268 
269  TwoDto2D_Eff(h_EffNumerator, h_EffDenominator, h_Efficiency);
270 
271  //add the efficiency for precision
272  for (int i = 0; i < 17; i++) {
273  TH2F* seg_prec_EffNumerator =
274  (TH2F*) dir1->Get(Form("%sSegments_%s_%s_etastation_nPrechit", plotdirname.Data(), recalg_path.Data(),
275  SegStationName[i]));
276  TH2F* seg_prec_EffDenominator =
277  (TH2F*) dir1->Get(Form("%sSegments_%s_eff_%s_etastation_nPrechit", plotdirname.Data(), recalg_path.Data(),
278  SegStationName[i]));
279  TH2F* seg_prec_Efficiency =
280  (TH2F*) dir1->Get(Form("%sSegments_%s_eff_%s_etastation_nPrechit", plotdirname.Data(), recalg_path.Data(),
281  SegStationName[i]));
282 
283  TwoDto2D_Eff(seg_prec_EffNumerator, seg_prec_EffDenominator, seg_prec_Efficiency);
284 
285  TH2F* seg_trig_EffNumerator =
286  (TH2F*) dir1->Get(Form("%sSegments_%s_%s_etastation_nTrighit", plotdirname.Data(), recalg_path.Data(),
287  SegStationName[i]));
288  TH2F* seg_trig_EffDenominator =
289  (TH2F*) dir1->Get(Form("%sSegments_%s_eff_%s_etastation_nTrighit", plotdirname.Data(), recalg_path.Data(),
290  SegStationName[i]));
291  TH2F* seg_trig_Efficiency =
292  (TH2F*) dir1->Get(Form("%sSegments_%s_eff_%s_etastation_nTrighit", plotdirname.Data(), recalg_path.Data(),
293  SegStationName[i]));
294 
295  TwoDto2D_Eff(seg_trig_EffNumerator, seg_trig_EffDenominator, seg_trig_Efficiency);
296  }
297  }//ends different subfolder for segment efficiency
298 
299  //Do the muon part
300  TString mDir_muons = motherDir + "Muons/";
301  if (!f->cd(mDir_muons)) return;
302 
303  TIter nextcd_muons(gDirectory->GetListOfKeys());
304  while (TKey* key1 = dynamic_cast<TKey*>(nextcd_muons())) {
305  //While in the segments
306  TString recalg_path = key1->GetName();
307  TString recalg_fullStr = mDir_muons + key1->GetName();
308  TDirectory* dir1 = f->GetDirectory(recalg_fullStr);
309  if (!dir1) continue;
310  dir1->cd();
311 
312  TString muonqualstr[4] = {
313  "Tight", "Medium", "Loose", "Veryloose"
314  };
315  // Divide the efficiency histograms
316  TH2F* h_EffDenominator =
317  (TH2F*) dir1->Get(Form("%sMuons_%s_Origin_eta_phi", plotdirname.Data(), recalg_path.Data()));
318  //m_EffDenominator->Rebin2D();//here change the default binnning of eta-phi! disabled once we are in 64 bins
319  for (int i = 0; i < 4; i++) {
320  TH2F* h_EffNumerator =
321  (TH2F*) dir1->Get(Form("%sMuons_%s_%s_eta_phi", plotdirname.Data(), recalg_path.Data(),
322  muonqualstr[i].Data()));
323  TH2F* h_Efficiency =
324  (TH2F*) dir1->Get(Form("%sMuons_%s_%s_eff", plotdirname.Data(), recalg_path.Data(), muonqualstr[i].Data()));
325  TwoDto2D_Eff(h_EffNumerator, h_EffDenominator, h_Efficiency);//here change the default binnning of eta-phi
326  }
327 
328  TH2F* eff_nPrec = (TH2F*) dir1->Get(Form("%sMuons_%s_eff_nPrec", plotdirname.Data(), recalg_path.Data()));
329  TH2F* eff_nPhi = (TH2F*) dir1->Get(Form("%sMuons_%s_eff_nPhi", plotdirname.Data(), recalg_path.Data()));
330  TH2F* eff_nTrigEta = (TH2F*) dir1->Get(Form("%sMuons_%s_eff_nTrigEta", plotdirname.Data(), recalg_path.Data()));
331  TH2F* eff_ndof = (TH2F*) dir1->Get(Form("%sMuons_%s_eff_ndof", plotdirname.Data(), recalg_path.Data()));
332  TH2F* eff_chi2 = (TH2F*) dir1->Get(Form("%sMuons_%s_eff_chi2", plotdirname.Data(), recalg_path.Data()));
333  TH2F* ID_eff_ndof = (TH2F*) dir1->Get(Form("%sMuons_%s_ID_eff_ndof", plotdirname.Data(), recalg_path.Data()));
334  TH2F* ID_eff_chi2 = (TH2F*) dir1->Get(Form("%sMuons_%s_ID_eff_chi2", plotdirname.Data(), recalg_path.Data()));
335  TH2F* MS_eff_ndof = (TH2F*) dir1->Get(Form("%sMuons_%s_MS_eff_ndof", plotdirname.Data(), recalg_path.Data()));
336  TH2F* MS_eff_chi2 = (TH2F*) dir1->Get(Form("%sMuons_%s_MS_eff_chi2", plotdirname.Data(), recalg_path.Data()));
337 
338  TH2F* avg_hits_precision_inner =
339  (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_precision_inner", plotdirname.Data(), recalg_path.Data()));
340  TH2F* avg_hits_precision_middle =
341  (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_precision_middle", plotdirname.Data(), recalg_path.Data()));
342  TH2F* avg_hits_precision_outer =
343  (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_precision_outer", plotdirname.Data(), recalg_path.Data()));
344  TH2F* avg_hits_precision_extended =
345  (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_precision_extended", plotdirname.Data(), recalg_path.Data()));
346 
347  TH2F* avg_hits_trigger_layer1 =
348  (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_trigger_layer1", plotdirname.Data(), recalg_path.Data()));
349  TH2F* avg_hits_trigger_layer2 =
350  (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_trigger_layer2", plotdirname.Data(), recalg_path.Data()));
351  TH2F* avg_hits_trigger_layer3 =
352  (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_trigger_layer3", plotdirname.Data(), recalg_path.Data()));
353  TH2F* avg_hits_trigger_layer4 =
354  (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_trigger_layer4", plotdirname.Data(), recalg_path.Data()));
355 
356  TH2F* avg_hits_ibl = (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_ibl", plotdirname.Data(), recalg_path.Data()));
357  TH2F* avg_hits_pix = (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_pix", plotdirname.Data(), recalg_path.Data()));
358  TH2F* avg_hits_sct = (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_sct", plotdirname.Data(), recalg_path.Data()));
359  TH2F* avg_hits_trt = (TH2F*) dir1->Get(Form("%sMuons_%s_avg_hits_trt", plotdirname.Data(), recalg_path.Data()));
360 
361  TH2F* avg_ddpt_idme = (TH2F*) dir1->Get(Form("%sMuons_%s_avg_ddpt_idme", plotdirname.Data(), recalg_path.Data()));
362  TH2F* avg_dptsignif = (TH2F*) dir1->Get(Form("%sMuons_%s_avg_dptsignif", plotdirname.Data(), recalg_path.Data()));
363 
364  TwoDto2D_Eff(eff_nPrec, h_EffDenominator, eff_nPrec);
365  TwoDto2D_Eff(eff_nPhi, h_EffDenominator, eff_nPhi);
366  TwoDto2D_Eff(eff_nTrigEta, h_EffDenominator, eff_nTrigEta);
367  TwoDto2D_Eff(eff_ndof, h_EffDenominator, eff_ndof);
368  TwoDto2D_Eff(eff_chi2, h_EffDenominator, eff_chi2);
369  TwoDto2D_Eff(ID_eff_ndof, h_EffDenominator, ID_eff_ndof);
370  TwoDto2D_Eff(ID_eff_chi2, h_EffDenominator, ID_eff_chi2);
371  TwoDto2D_Eff(MS_eff_ndof, h_EffDenominator, MS_eff_ndof);
372  TwoDto2D_Eff(MS_eff_chi2, h_EffDenominator, MS_eff_chi2);
373 
374  TwoDto2D_Eff(avg_hits_precision_inner, h_EffDenominator, avg_hits_precision_inner);
375  TwoDto2D_Eff(avg_hits_precision_middle, h_EffDenominator, avg_hits_precision_middle);
376  TwoDto2D_Eff(avg_hits_precision_outer, h_EffDenominator, avg_hits_precision_outer);
377  TwoDto2D_Eff(avg_hits_precision_extended, h_EffDenominator, avg_hits_precision_extended);
378 
379  TwoDto2D_Eff(avg_hits_trigger_layer1, h_EffDenominator, avg_hits_trigger_layer1);
380  TwoDto2D_Eff(avg_hits_trigger_layer2, h_EffDenominator, avg_hits_trigger_layer2);
381  TwoDto2D_Eff(avg_hits_trigger_layer3, h_EffDenominator, avg_hits_trigger_layer3);
382  TwoDto2D_Eff(avg_hits_trigger_layer4, h_EffDenominator, avg_hits_trigger_layer4);
383 
384  TwoDto2D_Eff(avg_hits_ibl, h_EffDenominator, avg_hits_ibl);
385  TwoDto2D_Eff(avg_hits_pix, h_EffDenominator, avg_hits_pix);
386  TwoDto2D_Eff(avg_hits_sct, h_EffDenominator, avg_hits_sct);
387  TwoDto2D_Eff(avg_hits_trt, h_EffDenominator, avg_hits_trt);
388 
389  TwoDto2D_Eff(avg_ddpt_idme, h_EffDenominator, avg_ddpt_idme);
390  TwoDto2D_Eff(avg_dptsignif, h_EffDenominator, avg_dptsignif);
391  }//ends different subfolder for muon efficiency
392 
393 
394  //Do the luminoisty part
395  TString mDir_lb = motherDir + "Overview/";
396  if (!f->cd(mDir_lb)) return;
397 
398  TIter nextcd_lb(gDirectory->GetListOfKeys());
399  while (TKey* key1 = dynamic_cast<TKey*>(nextcd_lb())) {
400  //While in the segments
401  TString recalg_path = key1->GetName();
402  TString recalg_fullStr = mDir_lb + key1->GetName();
403  TDirectory* dir1 = f->GetDirectory(recalg_fullStr);
404  if (!dir1) continue;
405  dir1->cd();
406 
407  TString montype[3] = {
408  "Segment", "MuonTrack", "Muon"
409  };
410  // Divide the efficiency histograms
411  for (int i = 0; i < 3; i++) {
412  TH2F* h_parent_lb =
413  (TH2F*) dir1->Get(Form("%sOverview_%s_n%s_LB_2D", plotdirname.Data(), recalg_path.Data(), montype[i].Data()));
414  TH1F* h_child_lb =
415  (TH1F*) dir1->Get(Form("%sOverview_%s_n%s_LB", plotdirname.Data(), recalg_path.Data(), montype[i].Data()));
416  //TH2F* h_parent_inst = (TH2F*)dir1->Get(Form("%sOverview_%s_n%s_Inst_2D", plotdirname.Data(),
417  // recalg_path.Data(), montype[i].Data()));
418  //TH1F* h_child_inst = (TH1F*)dir1->Get(Form("%sOverview_%s_n%s_Inst", plotdirname.Data(), recalg_path.Data(),
419  // montype[i].Data()));
420  //TH2F* h_parent_intlumi = (TH2F*)dir1->Get(Form("%sOverview_%s_n%s_IntLumi_2D", plotdirname.Data(),
421  // recalg_path.Data(), montype[i].Data()));
422  //TH1F* h_child_intlumi = (TH1F*)dir1->Get(Form("%sOverview_%s_n%s_IntLumi", plotdirname.Data(),
423  // recalg_path.Data(), montype[i].Data()));
424  TwoDto1D_Mean(h_parent_lb, h_child_lb);
425  //TwoDto1D_Mean(h_parent_inst, h_child_inst);
426  //TwoDto1D_Mean(h_parent_intlumi, h_child_intlumi);
427  }
428  TString resonance[2] = {
429  "Z", "Jpsi"
430  };
431  // Divide the efficiency histograms
432  for (int i = 0; i < 2; i++) {
433  TH2F* h_parent_lb =
434  (TH2F*) dir1->Get(Form("%sOverview_%s_n%s_LB_2D", plotdirname.Data(), recalg_path.Data(),
435  resonance[i].Data()));
436  TH1F* h_child_lb =
437  (TH1F*) dir1->Get(Form("%sOverview_%s_n%s_LB", plotdirname.Data(), recalg_path.Data(), resonance[i].Data()));
438  //TH2F* h_parent_inst = (TH2F*)dir1->Get(Form("%sOverview_%s_n%s_Inst_2D", plotdirname.Data(),
439  // recalg_path.Data(), resonance[i].Data()));
440  //TH1F* h_child_inst = (TH1F*)dir1->Get(Form("%sOverview_%s_n%s_Inst", plotdirname.Data(), recalg_path.Data(),
441  // resonance[i].Data()));
442  //TH2F* h_parent_intlumi = (TH2F*)dir1->Get(Form("%sOverview_%s_n%s_IntLumi_2D", plotdirname.Data(),
443  // recalg_path.Data(), resonance[i].Data()));
444  //TH1F* h_child_intlumi = (TH1F*)dir1->Get(Form("%sOverview_%s_n%s_IntLumi", plotdirname.Data(),
445  // recalg_path.Data(), resonance[i].Data()));
446  TwoDto1D_Sum(h_parent_lb, h_child_lb);
447  //TwoDto1D_Sum(h_parent_inst, h_child_inst);
448  //TwoDto1D_Sum(h_parent_intlumi, h_child_intlumi);
449  }
450  }//ends different subfolder for luminosity
451 
452 
453  //Do the muon part; only for the main directory!
454  if (!dirname.Contains("NoTrig")) {
455  //std::cout << "get to trackphys " << std::endl;
456  TString mDir_phys = motherDir + "MuonTrkPhys/";
457  if (!f->cd(mDir_phys)) return;
458 
459  TIter nextcd_phys(gDirectory->GetListOfKeys());
460  while (TKey* key1 = dynamic_cast<TKey*>(nextcd_phys())) {
461  //While in the segments
462  TString recalg_path = key1->GetName();
463  TString recalg_fullStr = mDir_phys + key1->GetName();
464  TDirectory* dir1 = f->GetDirectory(recalg_fullStr);
465  if (!dir1) continue;
466  dir1->cd();
467 
468  TH1* h_Mass_Mean = (TH1F*) dir1->Get(Form("m_%s_M_Mean", recalg_path.Data()));
469  TH1* h_Mass_Sigma = (TH1F*) dir1->Get(Form("m_%s_M_Sigma", recalg_path.Data()));
470  // Get each of the mass histograms
471  TString det_region[4] = {
472  "EC", "BC", "BA", "EA"
473  };
474  for (int i = 0; i < 4; i++) {
475  for (int j = 0; j < 4; j++) {
476  TH1* h_Mass_region = (TH1F*) dir1->Get(Form("m_%s_M_%s_%s", recalg_path.Data(),
477  det_region[i].Data(), det_region[j].Data()));
478  //std::cout << " bin " << i * 4 + (j + 1) << " content " << det_region[i] << " " << det_region[j] <<
479  // std::endl;
480  SetMassInfo(i * 4 + (j + 1), h_Mass_region, h_Mass_Mean, h_Mass_Sigma, recalg_path);
481  if (h_Mass_region != NULL) h_Mass_region->Write("", TObject::kOverwrite);
482  }
483  }
484  if (h_Mass_Mean != NULL) h_Mass_Mean->Write("", TObject::kOverwrite);
485  if (h_Mass_Sigma != NULL) h_Mass_Sigma->Write("", TObject::kOverwrite);
486  }
487  }//ends different subfolder for muon efficiency
488 
489  f->Close();
490  delete f;
491  return;
492  } //ends function

◆ MuonTrackPostProcess()

void dqutils::MonitoringFile::MuonTrackPostProcess ( const std::string &  inFileName,
bool  isIncremental = false 
)
static

Definition at line 207 of file MonitoringFile_MuonTrackPostProcess.cxx.

207  {
208  if (isIncremental) {
209  return;
210  }
211  MonitoringFile::MuonTrack_Main(inFilename, "");
212  MonitoringFile::MuonTrack_Main(inFilename, "NoTrig/");
213  return;
214  }

◆ nTGCWireStripMap()

int dqutils::MonitoringFile::nTGCWireStripMap ( int  ws,
int  etac,
int  phi48 
)
static

Definition at line 960 of file MonitoringFile_TGCPostProcess.cxx.

960  {//[0:1][0:42][1:48]
961  int layer = 0;
962  int eta = etac;
963  int st = 0;
964 // if ( etac <= 4 ){ layer = 0; eta = 4 - etac; st = 42;}
965 // else if ( etac <= 9 ){ layer = 1; eta = 9 - etac; st = 42;}
966 // else if ( etac <= 14 ){ layer = 2; eta = 14 - etac; st = 42;}
967 // else if ( etac <= 20 ){ layer = 3; eta = 20 - etac; st = 44;}
968 // else if ( etac <= 26 ){ layer = 4; eta = 26 - etac; st = 44;}
969 // else if ( etac <= 32 ){ layer = 5; eta = 32 - etac; st = 46;}
970 // else if ( etac <= 38 ){ layer = 6; eta = 38 - etac; st = 46;}
971 // else if ( etac <= 40 ){ layer = 7; eta = 40 - etac; st = 48;}
972 // else if ( etac <= 42 ){ layer = 8; eta = 42 - etac; st = 48;}
973 
974  int binx = etac + 1;
975 
976  if (binx % 7 >= 1 && binx % 7 <= 3 && binx <= 28) {
977  layer = (binx - 1) % 7;
978  eta = 4 - (binx - 1) / 7;
979  st = 42;
980  } else if (binx % 7 >= 4 && binx % 7 <= 5 && binx <= 28) {
981  layer = (binx - 1) % 7;
982  eta = 5 - (binx - 1) / 7;
983  st = 44;
984  } else if ((binx - 1) % 7 >= 5 && binx <= 28) {
985  layer = (binx - 1) % 7;
986  eta = 5 - (binx - 1) / 7;
987  st = 46;
988  } else if (binx > 28 && binx <= 30) {
989  layer = binx - 28 + 3 - 1;
990  eta = 1;
991  st = 44;
992  } else if (binx > 30 && binx <= 32) {
993  layer = binx - 28 + 3 - 1;
994  eta = 1;
995  st = 46;
996  } else if (binx > 32 && binx <= 35) {
997  layer = binx - 32 - 1;
998  eta = 0;
999  st = 42;
1000  } else if (binx > 35 && binx <= 37) {
1001  layer = binx - 32 - 1;
1002  eta = 0;
1003  st = 44;
1004  } else if (binx > 37 && binx <= 39) {
1005  layer = binx - 32 - 1;
1006  eta = 0;
1007  st = 46;
1008  } else if (binx > 39 && binx <= 41) {
1009  layer = binx - 32 - 1;
1010  eta = 1;
1011  st = 48;
1012  } else if (binx > 41 && binx <= 43) {
1013  layer = binx - 34 - 1;
1014  eta = 0;
1015  st = 48;
1016  }
1017 
1018 
1019  if (eta == 0) st -= 1;
1020 
1021 
1022  int nwire = getTGCNumberOfWires(st, layer, eta, phi48);
1023 
1024 
1025  //number of strips is always 32 except no chamber region which should be nwire==0.
1026  if (ws == 1) {
1027  if (nwire == 0) return 0;
1028 
1029  return 32;
1030  }
1031 
1032  return nwire;
1033  }

◆ PixelPostProcess()

void dqutils::MonitoringFile::PixelPostProcess ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

initialize

for hit occupancy

get histo

normalize

Write

for cluster occupancy

get histo

normalize

for error map

initialize

get histo

normalize

write

for disabled + sync errors module

normalize

Definition at line 41 of file MonitoringFile_PixelPostProcess.cxx.

41  {
42  if (rno_debug) std::cout << "Start Pixel post-processing" << std::endl;
43 
44  TFile* infile = TFile::Open(inFilename.c_str(), "UPDATE");
45  if (infile == 0 || !infile->IsOpen()) {
46  std::cerr << "--> PixelPostProcess: Input file not opened" << std::endl;
47  return;
48  }
49  if (infile->IsZombie()) {
50  std::cerr << "--> PixelPostProcess: Input file " << inFilename << " cannot be opened" << std::endl;
51  return;
52  }
53  if (infile->GetSize() < 1000) {
54  std::cerr << "--> PixelPostProcess: Input file empty " << std::endl;
55  return;
56  }
57 
58  //start postprocessing
59 
60  TIter next_run(infile->GetListOfKeys());
61  TKey* key_run(0);
62  key_run = (TKey*) next_run();
63  TDirectory* dir0 = dynamic_cast<TDirectory*> (key_run->ReadObj());
64  if (!dir0) return; // should never fail
65 
66  dir0->cd();
67 
68  TString run_dir;
69  int times = 1;
70  while (times--) { // just once
71  run_dir = dir0->GetName();
72 
73  TString rno_dir = run_dir + "/Pixel/Hits/";
74  TDirectory* dir = infile->GetDirectory(rno_dir);
75  if (!dir) {
76  std::cerr << "--> PixelPostProcess: directory " << rno_dir << " not found " << std::endl;
77  return;
78  }
79 
80  TString clus_dir = run_dir + "/Pixel/Clusters/";
81  TDirectory* clusdir = infile->GetDirectory(clus_dir);
82  if (!clusdir) {
83  std::cerr << "--> PixelPostProcess: directory " << clus_dir << " not found " << std::endl;
84  return;
85  }
86 
87  TString err_dir = run_dir + "/Pixel/Errors/";
88  TDirectory* errdir = infile->GetDirectory(err_dir);
89  if (!errdir) {
90  std::cerr << "--> PixelPostProcess: directory " << err_dir << " not found " << std::endl;
91  return;
92  }
93 
94  TString status_dir = run_dir + "/Pixel/Status/";
95  TDirectory* statusdir = infile->GetDirectory(status_dir);
96  if (!statusdir) {
97  std::cerr << "--> PixelPostProcess: directory " << status_dir << " not found " << std::endl;
98  return;
99  }
100 
101  TString norm_histName = rno_dir + "num_hits";
102  TH1F* h_norm = (TH1F*) infile->Get(norm_histName);
103  if (!h_norm) {
104  std::cerr << "--> PixelPostProcess: could not find normalisation histogram " << norm_histName << std::endl;
105  return;
106  }
107 
108  const static int nlayer = 8;
109  float nevents = h_norm->Integral(0, h_norm->GetNbinsX() + 1);
110  TString layerName[nlayer] = {
111  "IBL", "B0", "B1", "B2", "ECA", "ECC", "IBL2D", "IBL3D"
112  };
113  float npixel[nlayer] = {
114  26880, 46080, 46080, 46080, 46080, 46080, 26880, 26880
115  };
116  float nmodule[nlayer] = {
117  280., 286., 494., 676., 144., 144., 168., 112.
118  };
119 
120  const static int nerror = 5;
121  //TString errorName[nerror] = {"OpticalErrors_", "SEUErrors_", "SyncErrors_", "TimeoutErrors_", "TruncErrors_"};
122  TString errorName[nerror] = {
123  "OpticalErrors_", "SEUErrors_", "SyncErrors_", "TimeoutErrors_", "TruncErrors_"
124  };
125 
126  TH2F* h_occ[nlayer];
127  TH2F* h_occ_new[nlayer];
128  TH2F* h_clus[nlayer];
129  TH2F* h_clus_new[nlayer];
130  TH2F* h_err[nlayer][nerror];
131  TH2F* h_err_new[nlayer][nerror];
132  TH1F* h_disabled_per_lumi[nlayer];
133  TH1F* h_syncerr_per_lumi[nlayer];
134  TH1F* h_disabled_syncerr_per_lumi[nlayer];
135 
136  for (int i = 0; i < nlayer; i++) {
138  h_occ[i] = 0;
139  h_occ_new[i] = 0;
140  h_clus[i] = 0;
141  h_clus_new[i] = 0;
142  h_disabled_per_lumi[i] = 0;
143  h_syncerr_per_lumi[i] = 0;
144  h_disabled_syncerr_per_lumi[i] = 0;
145 
147 
149  TString keyname = "Occupancy_";
150  TString histName = rno_dir + keyname + layerName[i];
151  h_occ[i] = (TH2F*) infile->Get(histName);
153  if (h_occ[i]) {
154  TString tmpname = keyname + layerName[i] + "_byPostProcess";
155  h_occ_new[i] = (TH2F*) h_occ[i]->Clone(tmpname);
156  h_occ_new[i]->Scale(1.0 / (nevents * npixel[i]));
157  }
159  dir->cd();
160  if (h_occ_new[i]) h_occ_new[i]->Write();
161 
163 
165  keyname = "Cluster_Occupancy_";
166  histName = clus_dir + keyname + layerName[i];
167  h_clus[i] = (TH2F*) infile->Get(histName);
169  if (h_clus[i]) {
170  TString tmpname = keyname + layerName[i] + "_byPostProcess";
171  h_clus_new[i] = (TH2F*) h_clus[i]->Clone(tmpname);
172  h_clus_new[i]->Scale(1.0 / nevents);
173  }
174  clusdir->cd();
175  if (h_clus_new[i]) h_clus_new[i]->Write();
176 
178 
179  for (int j = 0; j < nerror; j++) {
181  h_err[i][j] = 0;
182  h_err_new[i][j] = 0;
184  keyname = errorName[j];
185  histName = err_dir + keyname + layerName[i];
186  h_err[i][j] = (TH2F*) infile->Get(histName);
188  if (h_err[i][j]) {
189  TString tmpname = keyname + layerName[i] + "_byPostProcess";
190  h_err_new[i][j] = (TH2F*) h_err[i][j]->Clone(tmpname);
191  h_err_new[i][j]->Scale(1.0 / nevents);
192  }
194  errdir->cd();
195  if (h_err_new[i][j]) h_err_new[i][j]->Write();
196  }
197 
199  keyname = "SyncErrorsFrac_per_event_";
200  histName = err_dir + keyname + layerName[i];
201  h_syncerr_per_lumi[i] = (TH1F*) infile->Get(histName);
202  keyname = "DisabledModules_per_lumi_";
203  histName = status_dir + keyname + layerName[i];
204  h_disabled_per_lumi[i] = (TH1F*) infile->Get(histName);
206  if (h_disabled_per_lumi[i] && h_syncerr_per_lumi[i]) {
207  keyname = "DisabledAndSyncErrorsModules_per_lumi_";
208  TString tmpname = keyname + layerName[i] + "_byPostProcess";
209  h_disabled_syncerr_per_lumi[i] = new TH1F(tmpname,
210  "Disable and Sync error per module per event;Lumi block;Avg. fraction per event", 2500, 0,
211  2500);
212  //h_disabled_syncerr_per_lumi[i]->Scale( 1.0/nmodule[i] );
213  for (int ibin = 0; ibin < 2500 + 1; ibin++) {
214  Double_t cont1 = h_disabled_per_lumi[i]->GetBinContent(ibin) / nmodule[i];
215  Double_t err1 = h_disabled_per_lumi[i]->GetBinError(ibin) / nmodule[i];
216  Double_t cont2 = h_syncerr_per_lumi[i]->GetBinContent(ibin);
217  Double_t err2 = h_syncerr_per_lumi[i]->GetBinError(ibin);
218  h_disabled_syncerr_per_lumi[i]->SetBinContent(ibin, cont1 + cont2);
219  h_disabled_syncerr_per_lumi[i]->SetBinError(ibin, err1 + err2);
220  }
221  }
222  errdir->cd();
223  if (h_disabled_syncerr_per_lumi[i]) h_disabled_syncerr_per_lumi[i]->Write();
224  }
225 
226 
227  infile->Write();
228  }//while
229  }

◆ printDirectories()

virtual void dqutils::MonitoringFile::printDirectories ( )
virtual

◆ printHanConfig()

virtual void dqutils::MonitoringFile::printHanConfig ( )
virtual

◆ printStatistics()

virtual void dqutils::MonitoringFile::printStatistics ( )
virtual

◆ ProcessAsymHistograms()

void dqutils::MonitoringFile::ProcessAsymHistograms ( TH1F *  m_neg,
TH1F *  m_pos,
TH1F *  m_asym 
)
static

Definition at line 3106 of file MonitoringFile_IDAlignPostProcess.cxx.

3107  {
3108  if (h_neg->GetNbinsX() != h_pos->GetNbinsX() || h_neg->GetNbinsX() != h_asym->GetNbinsX()) return;
3109 
3110  for (int i = 1; i <= h_neg->GetNbinsX(); i++) {
3111  float asym = 0;
3112  float err = 0;
3113  float a = h_neg->GetBinContent(i);
3114  float b = h_pos->GetBinContent(i);
3115  float e1 = h_neg->GetBinError(i);
3116  float e2 = h_pos->GetBinError(i);
3117  if ((a + b) > 0) {
3118  asym = (a - b) / (a + b);
3119  //error propagation
3120  err = sqrt((4 * b * b * e1 * e1 + 4 * a * a * e2 * e2) / pow(a + b, 4));
3121  }
3122  h_asym->SetBinContent(i, asym);
3123  h_asym->SetBinError(i, err);
3124  }
3125  }

◆ processModule()

void dqutils::MonitoringFile::processModule ( TFile *  f,
const std::string &  run_dir,
TKey *  key_module,
const std::string &  moduleName 
)
static

Definition at line 115 of file MonitoringFile_DiMuPostProcess.cxx.

116  {
117  TObject* obj_mod = key_module->ReadObj();
118  TDirectory* tdir_mod = dynamic_cast<TDirectory*>(obj_mod);
119 
120  if (tdir_mod != 0) {
121  TIter next_trigger(tdir_mod->GetListOfKeys());
122  TKey* key_trigger(0);
123  while ((key_trigger = dynamic_cast<TKey*>(next_trigger())) != 0) {
124  std::string triggerName = key_trigger->GetName();
125  fitMergedFile_DiMuMonAll(f, run_dir, moduleName, triggerName);
126  }
127  } else {
128  delete obj_mod;
129  }
130  }

◆ pv_PrimaryVertexMonitoring_calcResoAndEfficiency()

void dqutils::MonitoringFile::pv_PrimaryVertexMonitoring_calcResoAndEfficiency ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

Definition at line 35 of file MonitoringFile_IDEnhancedPrimaryVertex.cxx.

36  {
37 // std::cout << "\n";
38 // std::cout << "Running Inner-Detector primary vertexing monitoring analysis\n";
39 // std::cout << "\nWarning messages from fitting and histogram updating follow:\n\n";
40 
41  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
42 
43  if (f == 0 || !f->IsOpen()) {
44  //std::cerr << "MonitoringFile::PrimaryVertexMonitoring_calcResoAndEfficiency(): "
45 // << "Input file not opened\n";
46  delete f;
47  return;
48  }
49  if (f->GetSize() < 1000.) {
50 // std::cerr << "MonitoringFile::PrimaryVertexMonitoring_calcResoAndEfficiency(): "
51 // << "MonitoringFile empty\n";
52  delete f;
53  return;
54  }
55 
56  bool dirExists = false;
57  TString run_dir;
58  TIter next_run(f->GetListOfKeys());
59  TKey* key_run(0);
60  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
61  TObject* obj_run = key_run->ReadObj();
62  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
63  if (tdir_run != 0) {
64  std::string tdir_run_name(tdir_run->GetName());
65  if (tdir_run_name.find("run") != std::string::npos) {
66  run_dir = tdir_run_name;
67 
68  dirExists = f->GetDirectory(run_dir + "/InDetGlobal/PrimaryVertex");
69  if (dirExists) {
70 // std::cout << run_dir << "/InDetGlobal/PrimaryVertex exists. Creating and saving plots:" << std::endl;
71  f->cd(run_dir + "/InDetGlobal/PrimaryVertex");
72  }
73  }
74  } else {
75  delete obj_run;
76  }
77  }
78 
79  if (!dirExists) {
80  //std::cerr << "Either enhanced vertex info is not there or monitoring file was produced outside T0 context.
81  // Trying dir: InDetGlobal/PrimaryVertex\n";
82  dirExists = f->GetDirectory("InDetGlobal/PrimaryVertex");
83  if (dirExists) f->cd("InDetGlobal/PrimaryVertex");
84  }
85 
86  if (dirExists) {
87  // create histos
88  plotResolution("X", "Ntrk");
89  plotResolution("Y", "Ntrk");
90  plotResolution("Z", "Ntrk");
91 
92  plotResolution("X", "SumPt2");
93  plotResolution("Y", "SumPt2");
94  plotResolution("Z", "SumPt2");
95 
97  }
98 
99  f->Close();
100  delete f;
101 // std::cout << "\n";
102 // std::cout << "Finish Inner-Detector primary vertex monitoring analysis"<<std::endl;
103  return;
104  }

◆ RPCCheckHistogram()

bool dqutils::MonitoringFile::RPCCheckHistogram ( TFile *  f,
const char *  HistoName 
)
static

Definition at line 1665 of file MonitoringFile_RPCPostProcess.cxx.

1666  {
1667  if (!(f->Get(HistoName))) {
1668  return false;
1669  } else return true;
1670  }

◆ RPCPostProcess()

void dqutils::MonitoringFile::RPCPostProcess ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

create and insert entries in SQLite DB

Definition at line 89 of file MonitoringFile_RPCPostProcess.cxx.

89  {
90  bool applyEffThreshold = true;
91  bool EffThreshold = false;
92  bool printout = true;
93  float Minimum_efficiency = 0.5;
94  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
95  if (f == 0) {
96  std::cerr << "MonitoringFile::RPCPostProcess(): "
97  << "Input file not opened \n";
98  return;
99  }
100  if (f->GetSize() < 1000.) {
101  std::cerr << "MonitoringFile::RPCPostProcess(): "
102  << "Input file empty \n";
103  return;
104  }
105  CoolRpc coolrpc;
106 
107  // get run directory name
108  std::string run_dir;
109  TIter next_run(f->GetListOfKeys());
110  TKey* key_run(0);
111  while ((key_run = dynamic_cast<TKey*>(next_run())) != 0) {
112  TObject* obj_run = key_run->ReadObj();
113  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
114  if (tdir_run != 0) {
115  std::string tdir_run_name(tdir_run->GetName());
116  if (tdir_run_name.find("run") != std::string::npos) {
117  run_dir = std::move(tdir_run_name);
118 
119  int run_number = CxxUtils::atoi(run_dir.substr(4, run_dir.size() - 4));
120  std::cout << "run_number rpc monitoring " << run_number << std::endl;
121 
122  std::string pathRawMon = run_dir + "/Muon/MuonRawDataMonitoring/RPC/";
123  std::string pathTrackMon = run_dir + "/Muon/MuonRawDataMonitoring/RPCStandAloneTrackMon/";
124 
125  std::string dir_ov_raw = pathRawMon + "Overview/";
126  std::string dir_sum_raw = pathRawMon + "Summary/";
127  std::string dir_dqmf_raw = pathRawMon + "Dqmf/";
128 
129  std::string dir_sideA_track = pathTrackMon + "RPCBA/";
130  std::string dir_sideC_track = pathTrackMon + "RPCBC/";
131  std::string dir_glob_track = pathTrackMon + "GLOBAL/";
132  std::string dir_sum_track = pathTrackMon + "Summary/";
133  std::string dir_dqmf_track = pathTrackMon + "Dqmf/";
134  std::string dir_trigger_track = pathTrackMon + "TriggerEfficiency/";
135 
136  double n_hit_f, n_tr_p, panel_eff, panel_err_eff;
137  double nEta, nPhi, nEtaPhi, gapEff = 0.0, gapErrEff = 0.0;
138  double res_mean, res2_mean, res_RMS;
139  double panel_occ;
140  double panelCS, panelCS2, panelCS_entries, panelCS_mean, panelCS2_mean, panelCS_RMS;
141  double Time_mean, Time2_mean, Time_RMS;
142  double noiseCorr, noiseCorrErr;
143  double noiseTot, noiseTotErr;
144  double noiseErrNorm;
145 
146  // trigger efficiency
147  std::string METracks_name = dir_trigger_track + "hMEtracks";
148  std::string MuctpiThr0_name = dir_trigger_track + "hRPCMuctpiThr0";
149  std::string MuctpiThr1_name = dir_trigger_track + "hRPCMuctpiThr1";
150  std::string MuctpiThr2_name = dir_trigger_track + "hRPCMuctpiThr2";
151  std::string MuctpiThr3_name = dir_trigger_track + "hRPCMuctpiThr3";
152  std::string MuctpiThr4_name = dir_trigger_track + "hRPCMuctpiThr4";
153  std::string MuctpiThr5_name = dir_trigger_track + "hRPCMuctpiThr5";
154  std::string PadThr0_name = dir_trigger_track + "hRPCPadThr0";
155  std::string PadThr1_name = dir_trigger_track + "hRPCPadThr1";
156  std::string PadThr2_name = dir_trigger_track + "hRPCPadThr2";
157  std::string PadThr3_name = dir_trigger_track + "hRPCPadThr3";
158  std::string PadThr4_name = dir_trigger_track + "hRPCPadThr4";
159  std::string PadThr5_name = dir_trigger_track + "hRPCPadThr5";
160  std::string PhiEtaCoinThr0_name = dir_trigger_track + "hRPCPhiEtaCoinThr0";
161  std::string PhiEtaCoinThr1_name = dir_trigger_track + "hRPCPhiEtaCoinThr1";
162  std::string PhiEtaCoinThr2_name = dir_trigger_track + "hRPCPhiEtaCoinThr2";
163  std::string PhiEtaCoinThr3_name = dir_trigger_track + "hRPCPhiEtaCoinThr3";
164  std::string PhiEtaCoinThr4_name = dir_trigger_track + "hRPCPhiEtaCoinThr4";
165  std::string PhiEtaCoinThr5_name = dir_trigger_track + "hRPCPhiEtaCoinThr5";
166 
167  std::string MuctpiThr_eff0_name = dir_trigger_track + "hRPCMuctpiThr_eff0";
168  std::string MuctpiThr_eff1_name = dir_trigger_track + "hRPCMuctpiThr_eff1";
169  std::string MuctpiThr_eff2_name = dir_trigger_track + "hRPCMuctpiThr_eff2";
170  std::string MuctpiThr_eff3_name = dir_trigger_track + "hRPCMuctpiThr_eff3";
171  std::string MuctpiThr_eff4_name = dir_trigger_track + "hRPCMuctpiThr_eff4";
172  std::string MuctpiThr_eff5_name = dir_trigger_track + "hRPCMuctpiThr_eff5";
173  std::string PadThr_eff0_name = dir_trigger_track + "hRPCPadThr_eff0";
174  std::string PadThr_eff1_name = dir_trigger_track + "hRPCPadThr_eff1";
175  std::string PadThr_eff2_name = dir_trigger_track + "hRPCPadThr_eff2";
176  std::string PadThr_eff3_name = dir_trigger_track + "hRPCPadThr_eff3";
177  std::string PadThr_eff4_name = dir_trigger_track + "hRPCPadThr_eff4";
178  std::string PadThr_eff5_name = dir_trigger_track + "hRPCPadThr_eff5";
179  std::string PhiEtaCoinThr_eff0_name = dir_trigger_track + "hRPCPhiEtaCoinThr_eff0";
180  std::string PhiEtaCoinThr_eff1_name = dir_trigger_track + "hRPCPhiEtaCoinThr_eff1";
181  std::string PhiEtaCoinThr_eff2_name = dir_trigger_track + "hRPCPhiEtaCoinThr_eff2";
182  std::string PhiEtaCoinThr_eff3_name = dir_trigger_track + "hRPCPhiEtaCoinThr_eff3";
183  std::string PhiEtaCoinThr_eff4_name = dir_trigger_track + "hRPCPhiEtaCoinThr_eff4";
184  std::string PhiEtaCoinThr_eff5_name = dir_trigger_track + "hRPCPhiEtaCoinThr_eff5";
185 
186 
187  if (RPCCheckHistogram(f,
188  METracks_name.c_str()) &&
189  RPCCheckHistogram(f, MuctpiThr0_name.c_str()) && RPCCheckHistogram(f, MuctpiThr_eff0_name.c_str())) {
190  TH1I* hist_METracks = (TH1I*) (f->Get(METracks_name.c_str()));
191  TH1I* hist_MuctpiThr0 = (TH1I*) (f->Get(MuctpiThr0_name.c_str()));
192  TH1I* hist_MuctpiThr1 = (TH1I*) (f->Get(MuctpiThr1_name.c_str()));
193  TH1I* hist_MuctpiThr2 = (TH1I*) (f->Get(MuctpiThr2_name.c_str()));
194  TH1I* hist_MuctpiThr3 = (TH1I*) (f->Get(MuctpiThr3_name.c_str()));
195  TH1I* hist_MuctpiThr4 = (TH1I*) (f->Get(MuctpiThr4_name.c_str()));
196  TH1I* hist_MuctpiThr5 = (TH1I*) (f->Get(MuctpiThr5_name.c_str()));
197  TH1I* hist_PadThr0 = (TH1I*) (f->Get(PadThr0_name.c_str()));
198  TH1I* hist_PadThr1 = (TH1I*) (f->Get(PadThr1_name.c_str()));
199  TH1I* hist_PadThr2 = (TH1I*) (f->Get(PadThr2_name.c_str()));
200  TH1I* hist_PadThr3 = (TH1I*) (f->Get(PadThr3_name.c_str()));
201  TH1I* hist_PadThr4 = (TH1I*) (f->Get(PadThr4_name.c_str()));
202  TH1I* hist_PadThr5 = (TH1I*) (f->Get(PadThr5_name.c_str()));
203  TH1I* hist_PhiEtaCoinThr0 = (TH1I*) (f->Get(PhiEtaCoinThr0_name.c_str()));
204  TH1I* hist_PhiEtaCoinThr1 = (TH1I*) (f->Get(PhiEtaCoinThr1_name.c_str()));
205  TH1I* hist_PhiEtaCoinThr2 = (TH1I*) (f->Get(PhiEtaCoinThr2_name.c_str()));
206  TH1I* hist_PhiEtaCoinThr3 = (TH1I*) (f->Get(PhiEtaCoinThr3_name.c_str()));
207  TH1I* hist_PhiEtaCoinThr4 = (TH1I*) (f->Get(PhiEtaCoinThr4_name.c_str()));
208  TH1I* hist_PhiEtaCoinThr5 = (TH1I*) (f->Get(PhiEtaCoinThr5_name.c_str()));
209  TH1I* hist_MuctpiThr_eff0 = (TH1I*) (f->Get(MuctpiThr_eff0_name.c_str()));
210  TH1I* hist_MuctpiThr_eff1 = (TH1I*) (f->Get(MuctpiThr_eff1_name.c_str()));
211  TH1I* hist_MuctpiThr_eff2 = (TH1I*) (f->Get(MuctpiThr_eff2_name.c_str()));
212  TH1I* hist_MuctpiThr_eff3 = (TH1I*) (f->Get(MuctpiThr_eff3_name.c_str()));
213  TH1I* hist_MuctpiThr_eff4 = (TH1I*) (f->Get(MuctpiThr_eff4_name.c_str()));
214  TH1I* hist_MuctpiThr_eff5 = (TH1I*) (f->Get(MuctpiThr_eff5_name.c_str()));
215  TH1I* hist_PadThr_eff0 = (TH1I*) (f->Get(PadThr_eff0_name.c_str()));
216  TH1I* hist_PadThr_eff1 = (TH1I*) (f->Get(PadThr_eff1_name.c_str()));
217  TH1I* hist_PadThr_eff2 = (TH1I*) (f->Get(PadThr_eff2_name.c_str()));
218  TH1I* hist_PadThr_eff3 = (TH1I*) (f->Get(PadThr_eff3_name.c_str()));
219  TH1I* hist_PadThr_eff4 = (TH1I*) (f->Get(PadThr_eff4_name.c_str()));
220  TH1I* hist_PadThr_eff5 = (TH1I*) (f->Get(PadThr_eff5_name.c_str()));
221  TH1I* hist_PhiEtaCoinThr_eff0 = (TH1I*) (f->Get(PhiEtaCoinThr_eff0_name.c_str()));
222  TH1I* hist_PhiEtaCoinThr_eff1 = (TH1I*) (f->Get(PhiEtaCoinThr_eff1_name.c_str()));
223  TH1I* hist_PhiEtaCoinThr_eff2 = (TH1I*) (f->Get(PhiEtaCoinThr_eff2_name.c_str()));
224  TH1I* hist_PhiEtaCoinThr_eff3 = (TH1I*) (f->Get(PhiEtaCoinThr_eff3_name.c_str()));
225  TH1I* hist_PhiEtaCoinThr_eff4 = (TH1I*) (f->Get(PhiEtaCoinThr_eff4_name.c_str()));
226  TH1I* hist_PhiEtaCoinThr_eff5 = (TH1I*) (f->Get(PhiEtaCoinThr_eff5_name.c_str()));
227 
228  int nb = hist_METracks->GetNbinsX();
229  double Ly_eff, Ly_effErr;
230  auto calculateErr = [](float hitOn, float trPrj) -> double {
231  return std::sqrt(std::abs(hitOn) / trPrj) *
232  std::sqrt(1. - std::abs(hitOn) / trPrj) / std::sqrt(trPrj);
233  };
234  for (int ib = 0; ib != nb; ib++) {
235  float n_Ly_hitOn = hist_MuctpiThr0->GetBinContent(ib + 1);
236  float n_Ly_TrPrj = hist_METracks->GetBinContent(ib + 1);
237  if (n_Ly_TrPrj<= 0) continue;
238  //MuctpiThr0
239  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
240 
241  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
242  hist_MuctpiThr_eff0->SetBinContent(ib + 1, Ly_eff);
243  hist_MuctpiThr_eff0->SetBinError(ib + 1, Ly_effErr);
244 
245  //MuctpiThr1
246  n_Ly_hitOn = hist_MuctpiThr1->GetBinContent(ib + 1);
247  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
248  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
249  hist_MuctpiThr_eff1->SetBinContent(ib + 1, Ly_eff);
250  hist_MuctpiThr_eff1->SetBinError(ib + 1, Ly_effErr);
251  //MuctpiThr2
252  n_Ly_hitOn = hist_MuctpiThr2->GetBinContent(ib + 1);
253  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
254 
255  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
256  hist_MuctpiThr_eff2->SetBinContent(ib + 1, Ly_eff);
257  hist_MuctpiThr_eff2->SetBinError(ib + 1, Ly_effErr);
258  //MuctpiThr3
259  n_Ly_hitOn = hist_MuctpiThr3->GetBinContent(ib + 1);
260  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
261 
262  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
263  hist_MuctpiThr_eff3->SetBinContent(ib + 1, Ly_eff);
264  hist_MuctpiThr_eff3->SetBinError(ib + 1, Ly_effErr);
265  //MuctpiThr4
266  n_Ly_hitOn = hist_MuctpiThr4->GetBinContent(ib + 1);
267  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
268 
269  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
270  hist_MuctpiThr_eff4->SetBinContent(ib + 1, Ly_eff);
271  hist_MuctpiThr_eff4->SetBinError(ib + 1, Ly_effErr);
272  //MuctpiThr5
273  n_Ly_hitOn = hist_MuctpiThr5->GetBinContent(ib + 1);
274  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
275 
276  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
277  hist_MuctpiThr_eff5->SetBinContent(ib + 1, Ly_eff);
278  hist_MuctpiThr_eff5->SetBinError(ib + 1, Ly_effErr);
279  //PadThr0
280  n_Ly_hitOn = hist_PadThr0->GetBinContent(ib + 1);
281  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
282 
283  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
284  hist_PadThr_eff0->SetBinContent(ib + 1, Ly_eff);
285  hist_PadThr_eff0->SetBinError(ib + 1, Ly_effErr);
286  //PadThr1
287  n_Ly_hitOn = hist_PadThr1->GetBinContent(ib + 1);
288  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
289 
290  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
291  hist_PadThr_eff1->SetBinContent(ib + 1, Ly_eff);
292  hist_PadThr_eff1->SetBinError(ib + 1, Ly_effErr);
293  //PadThr2
294  n_Ly_hitOn = hist_PadThr2->GetBinContent(ib + 1);
295  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
296 
297  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
298  hist_PadThr_eff2->SetBinContent(ib + 1, Ly_eff);
299  hist_PadThr_eff2->SetBinError(ib + 1, Ly_effErr);
300  //PadThr3
301  n_Ly_hitOn = hist_PadThr3->GetBinContent(ib + 1);
302  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
303 
304  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
305  hist_PadThr_eff3->SetBinContent(ib + 1, Ly_eff);
306  hist_PadThr_eff3->SetBinError(ib + 1, Ly_effErr);
307  //PadThr4
308  n_Ly_hitOn = hist_PadThr4->GetBinContent(ib + 1);
309  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
310 
311  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
312  hist_PadThr_eff4->SetBinContent(ib + 1, Ly_eff);
313  hist_PadThr_eff4->SetBinError(ib + 1, Ly_effErr);
314  //PadThr5
315  n_Ly_hitOn = hist_PadThr5->GetBinContent(ib + 1);
316  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
317 
318  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
319  hist_PadThr_eff5->SetBinContent(ib + 1, Ly_eff);
320  hist_PadThr_eff5->SetBinError(ib + 1, Ly_effErr);
321  //PhiEtaCoinThr0
322  n_Ly_hitOn = hist_PhiEtaCoinThr0->GetBinContent(ib + 1);
323  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
324 
325  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
326  hist_PhiEtaCoinThr_eff0->SetBinContent(ib + 1, Ly_eff);
327  hist_PhiEtaCoinThr_eff0->SetBinError(ib + 1, Ly_effErr);
328  //PhiEtaCoinThr1
329  n_Ly_hitOn = hist_PhiEtaCoinThr1->GetBinContent(ib + 1);
330  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
331 
332  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
333  hist_PhiEtaCoinThr_eff1->SetBinContent(ib + 1, Ly_eff);
334  hist_PhiEtaCoinThr_eff1->SetBinError(ib + 1, Ly_effErr);
335  //PhiEtaCoinThr2
336  n_Ly_hitOn = hist_PhiEtaCoinThr2->GetBinContent(ib + 1);
337  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
338 
339  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
340  hist_PhiEtaCoinThr_eff2->SetBinContent(ib + 1, Ly_eff);
341  hist_PhiEtaCoinThr_eff2->SetBinError(ib + 1, Ly_effErr);
342  //PhiEtaCoinThr3
343  n_Ly_hitOn = hist_PhiEtaCoinThr3->GetBinContent(ib + 1);
344  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
345 
346  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
347  hist_PhiEtaCoinThr_eff3->SetBinContent(ib + 1, Ly_eff);
348  hist_PhiEtaCoinThr_eff3->SetBinError(ib + 1, Ly_effErr);
349  //PhiEtaCoinThr4
350  n_Ly_hitOn = hist_PhiEtaCoinThr4->GetBinContent(ib + 1);
351  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
352 
353  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
354  hist_PhiEtaCoinThr_eff4->SetBinContent(ib + 1, Ly_eff);
355  hist_PhiEtaCoinThr_eff4->SetBinError(ib + 1, Ly_effErr);
356  //PhiEtaCoinThr5
357  n_Ly_hitOn = hist_PhiEtaCoinThr5->GetBinContent(ib + 1);
358  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
359 
360  Ly_effErr = calculateErr(n_Ly_hitOn, n_Ly_TrPrj);
361  hist_PhiEtaCoinThr_eff5->SetBinContent(ib + 1, Ly_eff);
362  hist_PhiEtaCoinThr_eff5->SetBinError(ib + 1, Ly_effErr);
363 
364  }
365 
366  // write out histogram
367  TDirectory* dir = f->GetDirectory(dir_trigger_track.c_str());
368  if (dir != 0) {
369  dir->cd();
370  hist_MuctpiThr_eff0->Write("", TObject::kOverwrite);
371  hist_MuctpiThr_eff1->Write("", TObject::kOverwrite);
372  hist_MuctpiThr_eff2->Write("", TObject::kOverwrite);
373  hist_MuctpiThr_eff3->Write("", TObject::kOverwrite);
374  hist_MuctpiThr_eff4->Write("", TObject::kOverwrite);
375  hist_MuctpiThr_eff5->Write("", TObject::kOverwrite);
376  hist_PadThr_eff0->Write("", TObject::kOverwrite);
377  hist_PadThr_eff1->Write("", TObject::kOverwrite);
378  hist_PadThr_eff2->Write("", TObject::kOverwrite);
379  hist_PadThr_eff3->Write("", TObject::kOverwrite);
380  hist_PadThr_eff4->Write("", TObject::kOverwrite);
381  hist_PadThr_eff5->Write("", TObject::kOverwrite);
382  hist_PhiEtaCoinThr_eff0->Write("", TObject::kOverwrite);
383  hist_PhiEtaCoinThr_eff1->Write("", TObject::kOverwrite);
384  hist_PhiEtaCoinThr_eff2->Write("", TObject::kOverwrite);
385  hist_PhiEtaCoinThr_eff3->Write("", TObject::kOverwrite);
386  hist_PhiEtaCoinThr_eff4->Write("", TObject::kOverwrite);
387  hist_PhiEtaCoinThr_eff5->Write("", TObject::kOverwrite);
388  }
389  }
390 
391 
392  // layer efficiency
393  std::string LyHit_name, LyPrj_name, LyEff_name;
394  LyHit_name = dir_glob_track + "Hit_on_Track_Layer";
395  LyPrj_name = dir_glob_track + "Track_Projected_on_Layer";
396  LyEff_name = dir_glob_track + "Layer_Efficiency";
397 
398  if (RPCCheckHistogram(f, LyHit_name.c_str()) &&
399  RPCCheckHistogram(f, LyPrj_name.c_str()) && RPCCheckHistogram(f, LyEff_name.c_str())) {
400  TH1I* hist_LyHit = (TH1I*) (f->Get(LyHit_name.c_str()));
401  TH1I* hist_LyPrj = (TH1I*) (f->Get(LyPrj_name.c_str()));
402  TH1F* hist_LyEff = (TH1F*) (f->Get(LyEff_name.c_str()));
403 
404  int nb = hist_LyEff->GetNbinsX();
405  double Ly_eff, Ly_effErr;
406  for (int ib = 0; ib != nb; ib++) {
407  float n_Ly_hitOn = hist_LyHit->GetBinContent(ib + 1);
408  float n_Ly_TrPrj = hist_LyPrj->GetBinContent(ib + 1);
409 
410  if (n_Ly_TrPrj > 0) {
411  Ly_eff = float(n_Ly_hitOn) / float(n_Ly_TrPrj);
412  Ly_effErr = sqrt(fabs(n_Ly_hitOn) / n_Ly_TrPrj) *
413  sqrt(1. - fabs(n_Ly_hitOn) / n_Ly_TrPrj) /
414  sqrt(n_Ly_TrPrj);
415  hist_LyEff->SetBinContent(ib + 1, Ly_eff);
416  hist_LyEff->SetBinError(ib + 1, Ly_effErr);
417  }
418  }
419 
420  // write out histogram
421  TDirectory* dir = f->GetDirectory(dir_glob_track.c_str());
422  writeToFile(dir, hist_LyEff);
423  }
424 
425 
426  // layer efficiency Side A
427  std::string LyHit_SideA_name, LyPrj_SideA_name, LyEff_SideA_name;
428  LyHit_SideA_name = dir_sideA_track + "Layer_HitOnTrack_sideA";
429  LyPrj_SideA_name = dir_sideA_track + "Layer_TrackProj_sideA";
430  LyEff_SideA_name = dir_sideA_track + "Layer_Efficiency_sideA";
431 
432  if (RPCCheckHistogram(f, LyHit_SideA_name.c_str()) &&
433  RPCCheckHistogram(f, LyPrj_SideA_name.c_str()) &&
434  RPCCheckHistogram(f, LyEff_SideA_name.c_str())) {
435  TH1I* hist_LyHit_SideA = (TH1I*) (f->Get(LyHit_SideA_name.c_str()));
436  TH1I* hist_LyPrj_SideA = (TH1I*) (f->Get(LyPrj_SideA_name.c_str()));
437  TH1F* hist_LyEff_SideA = (TH1F*) (f->Get(LyEff_SideA_name.c_str()));
438 
439  int nb = hist_LyEff_SideA->GetNbinsX();
440  double Ly_eff_SideA, Ly_effErr_SideA;
441  for (int ib = 0; ib != nb; ib++) {
442  float n_Ly_hitOn_SideA = hist_LyHit_SideA->GetBinContent(ib + 1);
443  float n_Ly_TrPrj_SideA = hist_LyPrj_SideA->GetBinContent(ib + 1);
444 
445  if (n_Ly_TrPrj_SideA > 0) {
446  Ly_eff_SideA = float(n_Ly_hitOn_SideA) / float(n_Ly_TrPrj_SideA);
447 
448  Ly_effErr_SideA = sqrt(fabs(n_Ly_hitOn_SideA) / n_Ly_TrPrj_SideA) *
449  sqrt(1. - fabs(n_Ly_hitOn_SideA) / n_Ly_TrPrj_SideA) /
450  sqrt(n_Ly_TrPrj_SideA);
451  hist_LyEff_SideA->SetBinContent(ib + 1, Ly_eff_SideA);
452  hist_LyEff_SideA->SetBinError(ib + 1, Ly_effErr_SideA);
453  }
454  }
455 
456  // write out histogram
457  TDirectory* dir = f->GetDirectory(dir_sideA_track.c_str());
458  writeToFile(dir, hist_LyEff_SideA);
459 
460  }
461 
462  // layer efficiency Side C
463  std::string LyHit_SideC_name, LyPrj_SideC_name, LyEff_SideC_name;
464  LyHit_SideC_name = dir_sideC_track + "Layer_HitOnTrack_sideC";
465  LyPrj_SideC_name = dir_sideC_track + "Layer_TrackProj_sideC";
466  LyEff_SideC_name = dir_sideC_track + "Layer_Efficiency_sideC";
467 
468  if (RPCCheckHistogram(f, LyHit_SideC_name.c_str()) &&
469  RPCCheckHistogram(f, LyPrj_SideC_name.c_str()) &&
470  RPCCheckHistogram(f, LyEff_SideC_name.c_str())) {
471  TH1I* hist_LyHit_SideC = (TH1I*) (f->Get(LyHit_SideC_name.c_str()));
472  TH1I* hist_LyPrj_SideC = (TH1I*) (f->Get(LyPrj_SideC_name.c_str()));
473  TH1F* hist_LyEff_SideC = (TH1F*) (f->Get(LyEff_SideC_name.c_str()));
474 
475  int nb = hist_LyEff_SideC->GetNbinsX();
476  double Ly_eff_SideC, Ly_effErr_SideC;
477  for (int ib = 0; ib != nb; ib++) {
478  float n_Ly_hitOn_SideC = hist_LyHit_SideC->GetBinContent(ib + 1);
479  float n_Ly_TrPrj_SideC = hist_LyPrj_SideC->GetBinContent(ib + 1);
480 
481  if (n_Ly_TrPrj_SideC > 0) {
482  Ly_eff_SideC = float(n_Ly_hitOn_SideC) / float(n_Ly_TrPrj_SideC);
483 
484  Ly_effErr_SideC = sqrt(fabs(n_Ly_hitOn_SideC) / n_Ly_TrPrj_SideC) *
485  sqrt(1. - fabs(n_Ly_hitOn_SideC) / n_Ly_TrPrj_SideC) /
486  sqrt(n_Ly_TrPrj_SideC);
487  hist_LyEff_SideC->SetBinContent(ib + 1, Ly_eff_SideC);
488  hist_LyEff_SideC->SetBinError(ib + 1, Ly_effErr_SideC);
489  }
490  }
491  // write out histogram
492  TDirectory* dir = f->GetDirectory(dir_sideC_track.c_str());
493  writeToFile(dir, hist_LyEff_SideC);
494 
495  }
496 
497 
498 
499  int rpc_eventstotal = 0;
500  if (RPCCheckHistogram(f, (dir_ov_raw + "Number_of_RPC_hits_per_event").c_str())) {
501  TH1I* rpc_hits = (TH1I*) (f->Get((dir_ov_raw + "Number_of_RPC_hits_per_event").c_str()));
502  rpc_eventstotal = int(rpc_hits->GetEntries());
503  }
504 
505 
506  // distribution plot all atlas
507  std::string AverageEff_C_name = dir_sideC_track + "Efficiency_Distribution_sideC";
508  std::string AverageEff_A_name = dir_sideA_track + "Efficiency_Distribution_sideA";
509  std::string AverageGapEff_C_name = dir_sideC_track + "GapEfficiency_Distribution_sideC";
510  std::string AverageGapEff_A_name = dir_sideA_track + "GapEfficiency_Distribution_sideA";
511  std::string AverageNoiseCorr_C_name = dir_sideC_track + "NoiseCorr_Distribution_sideC";
512  std::string AverageNoiseCorr_A_name = dir_sideA_track + "NoiseCorr_Distribution_sideA";
513  std::string AverageNoiseTot_C_name = dir_sideC_track + "NoiseTot_Distribution_sideC";
514  std::string AverageNoiseTot_A_name = dir_sideA_track + "NoiseTot_Distribution_sideA";
515  std::string AverageCS_C_name = dir_sideC_track + "CS_Distribution_sideC";
516  std::string AverageCS_A_name = dir_sideA_track + "CS_Distribution_sideA";
517  std::string AverageRes_CS1_C_name = dir_sideC_track + "Res_CS1_Distribution_sideC";
518  std::string AverageRes_CS1_A_name = dir_sideA_track + "Res_CS1_Distribution_sideA";
519  std::string AverageRes_CS2_C_name = dir_sideC_track + "Res_CS2_Distribution_sideC";
520  std::string AverageRes_CS2_A_name = dir_sideA_track + "Res_CS2_Distribution_sideA";
521  std::string AverageRes_CSmore2_C_name = dir_sideC_track + "Res_CSmore2_Distribution_sideC";
522  std::string AverageRes_CSmore2_A_name = dir_sideA_track + "Res_CSmore2_Distribution_sideA";
523  std::string AverageRes_CS1rms_C_name = dir_sideC_track + "Res_CS1rms_Distribution_sideC";
524  std::string AverageRes_CS1rms_A_name = dir_sideA_track + "Res_CS1rms_Distribution_sideA";
525  std::string AverageRes_CS2rms_C_name = dir_sideC_track + "Res_CS2rms_Distribution_sideC";
526  std::string AverageRes_CS2rms_A_name = dir_sideA_track + "Res_CS2rms_Distribution_sideA";
527  std::string AverageRes_CSmore2rms_C_name = dir_sideC_track + "Res_CSmore2rms_Distribution_sideC";
528  std::string AverageRes_CSmore2rms_A_name = dir_sideA_track + "Res_CSmore2rms_Distribution_sideA";
529  std::string AverageOccupancy_C_name = dir_sideC_track + "Occupancy_Distribution_sideC";
530  std::string AverageOccupancy_A_name = dir_sideA_track + "Occupancy_Distribution_sideA";
531  std::string AverageTime_C_name = dir_sideC_track + "Time_Distribution_sideC";
532  std::string AverageTime_A_name = dir_sideA_track + "Time_Distribution_sideA";
533 
534 
535  auto initialiseHisto = [f](const std::string& name) -> TH1F* {
536  TH1F* result = (TH1F*) (f->Get(name.c_str()));
537 
538  return result;
539  };
540 
541  TH1F* h_AverageEff_C = initialiseHisto(AverageEff_C_name);
542  TH1F* h_AverageEff_A = initialiseHisto(AverageEff_A_name);
543  TH1F* h_AverageGapEff_C = initialiseHisto(AverageGapEff_C_name);
544  TH1F* h_AverageGapEff_A = initialiseHisto(AverageGapEff_A_name);
545  TH1F* h_AverageNoiseCorr_C = initialiseHisto(AverageNoiseCorr_C_name);
546  TH1F* h_AverageNoiseCorr_A = initialiseHisto(AverageNoiseCorr_A_name);
547  TH1F* h_AverageNoiseTot_C = initialiseHisto(AverageNoiseTot_C_name);
548  TH1F* h_AverageNoiseTot_A = initialiseHisto(AverageNoiseTot_A_name);
549  TH1F* h_AverageCS_C = initialiseHisto(AverageCS_C_name);
550  TH1F* h_AverageCS_A = initialiseHisto(AverageCS_A_name);
551  TH1F* h_AverageRes_CS1_C = initialiseHisto(AverageRes_CS1_C_name);
552  TH1F* h_AverageRes_CS1_A = initialiseHisto(AverageRes_CS1_A_name);
553  TH1F* h_AverageRes_CS2_C = initialiseHisto(AverageRes_CS2_C_name);
554  TH1F* h_AverageRes_CS2_A = initialiseHisto(AverageRes_CS2_A_name);
555  TH1F* h_AverageRes_CSmore2_C = initialiseHisto(AverageRes_CSmore2_C_name);
556  TH1F* h_AverageRes_CSmore2_A = initialiseHisto(AverageRes_CSmore2_A_name);
557  TH1F* h_AverageRes_CS1rms_C = initialiseHisto(AverageRes_CS1rms_C_name);
558  TH1F* h_AverageRes_CS1rms_A = initialiseHisto(AverageRes_CS1rms_A_name);
559  TH1F* h_AverageRes_CS2rms_C = initialiseHisto(AverageRes_CS2rms_C_name);
560  TH1F* h_AverageRes_CS2rms_A = initialiseHisto(AverageRes_CS2rms_A_name);
561  TH1F* h_AverageRes_CSmore2rms_C = initialiseHisto(AverageRes_CSmore2rms_C_name);
562  TH1F* h_AverageRes_CSmore2rms_A = initialiseHisto(AverageRes_CSmore2rms_A_name);
563  TH1F* h_AverageOccupancy_C = initialiseHisto(AverageOccupancy_C_name);
564  TH1F* h_AverageOccupancy_A = initialiseHisto(AverageOccupancy_A_name);
565  TH1F* h_AverageTime_C = initialiseHisto(AverageTime_C_name);
566  TH1F* h_AverageTime_A = initialiseHisto(AverageTime_A_name);
567 
568  auto resetIfValid = [](TH1F* pH) -> void {
569  if (pH) pH->Reset();
570  return;
571  };
572 
573 
574 
575  resetIfValid(h_AverageEff_C);
576  resetIfValid(h_AverageEff_A);
577  resetIfValid(h_AverageGapEff_C);
578  resetIfValid(h_AverageGapEff_A);
579  resetIfValid(h_AverageNoiseCorr_C);
580  resetIfValid(h_AverageNoiseCorr_A);
581  resetIfValid(h_AverageNoiseTot_C);
582  resetIfValid(h_AverageNoiseTot_A);
583  resetIfValid(h_AverageCS_C);
584  resetIfValid(h_AverageCS_A);
585  resetIfValid(h_AverageRes_CS1_C);
586  resetIfValid(h_AverageRes_CS1_A);
587  resetIfValid(h_AverageRes_CS2_C);
588  resetIfValid(h_AverageRes_CS2_A);
589  resetIfValid(h_AverageRes_CSmore2_C);
590  resetIfValid(h_AverageRes_CSmore2_A);
591  resetIfValid(h_AverageRes_CS1rms_C);
592  resetIfValid(h_AverageRes_CS1rms_A);
593  resetIfValid(h_AverageRes_CS2rms_C);
594  resetIfValid(h_AverageRes_CS2rms_A);
595  resetIfValid(h_AverageRes_CSmore2rms_C);
596  resetIfValid(h_AverageRes_CSmore2rms_A);
597  resetIfValid(h_AverageOccupancy_C);
598  resetIfValid(h_AverageOccupancy_A);
599  resetIfValid(h_AverageTime_C);
600  resetIfValid(h_AverageTime_A);
601 
602  // summary plots
603  int countpanelindb = 0;
604  int countpaneleff0 = 0;
605  int countpaneltrack0 = 0;
606  for (int i_sec = 0; i_sec != 15 * 1 + 1; i_sec++) {
607  char sector_char[100];
608  std::string sector_name;
609  sprintf(sector_char, "_Sector%.2d", i_sec + 1); // sector number with 2 digits
610  sector_name = sector_char;
611  std::cout << " RPC sector_name processing " << sector_name << std::endl;
612 
613  std::string TrackProj_name = dir_sum_track + "SummaryTrackProj" + sector_name;
614  std::string HitOnTrack_name = dir_sum_track + "SummaryHitOnTrack" + sector_name;
615  std::string HitOnTrackCross_name = dir_sum_track + "SummaryHitOnTrack_withCrossStrip" + sector_name;
616  std::string Eff_name = dir_sum_track + "SummaryEfficiency" + sector_name;
617  std::string GapEff_name = dir_sum_track + "SummaryGapEfficiency" + sector_name;
618  std::string NoiseCorr_name = dir_sum_track + "SummaryNoiseCorr" + sector_name;
619  std::string NoiseCorr_s_name = dir_sum_track + "SummaryNoiseCorr_NotNorm" + sector_name;
620  std::string NoiseTot_name = dir_sum_track + "SummaryNoiseTot" + sector_name;
621  std::string NoiseTot_s_name = dir_sum_track + "SummaryNoiseTot_NotNorm" + sector_name;
622  std::string Res_CS1_name = dir_sum_track + "SummaryRes_CS1" + sector_name;
623  std::string Res_CS1_s_name = dir_sum_track + "SummaryRes_CS1_NotNorm" + sector_name;
624  std::string Res_CS1_square_name = dir_sum_track + "SummaryRes_CS1_square" + sector_name;
625  std::string Res_CS1_entries_name = dir_sum_track + "SummaryRes_CS1_entries" + sector_name;
626  std::string Res_CS2_name = dir_sum_track + "SummaryRes_CS2" + sector_name;
627  std::string Res_CS2_s_name = dir_sum_track + "SummaryRes_CS2_NotNorm" + sector_name;
628  std::string Res_CS2_square_name = dir_sum_track + "SummaryRes_CS2_square" + sector_name;
629  std::string Res_CS2_entries_name = dir_sum_track + "SummaryRes_CS2_entries" + sector_name;
630  std::string Res_CSmore2_name = dir_sum_track + "SummaryRes_CSmore2" + sector_name;
631  std::string Res_CSmore2_s_name = dir_sum_track + "SummaryRes_CSmore2_NotNorm" + sector_name;
632  std::string Res_CSmore2_square_name = dir_sum_track + "SummaryRes_CSmore2_square" + sector_name;
633  std::string Res_CSmore2_entries_name = dir_sum_track + "SummaryRes_CSmore2_entries" + sector_name;
634  std::string CS_name = dir_sum_track + "SummaryCS" + sector_name;
635  std::string CS_s_name = dir_sum_track + "SummaryCS_NotNorm" + sector_name;
636  std::string CS_square_name = dir_sum_track + "SummaryCS_square" + sector_name;
637  std::string CS_entries_name = dir_sum_track + "SummaryCS_entries" + sector_name;
638  std::string CS1_entries_name = dir_sum_track + "SummaryCS1_entries" + sector_name;
639  std::string CS2_entries_name = dir_sum_track + "SummaryCS2_entries" + sector_name;
640  std::string Time_name = dir_sum_track + "SummaryTime" + sector_name;
641  std::string Time_s_name = dir_sum_track + "SummaryTime_NotNorm" + sector_name;
642  std::string Time_square_name = dir_sum_track + "SummaryTime_square" + sector_name;
643  std::string Occupancy_name = dir_sum_track + "SummaryOccupancy" + sector_name;
644  std::string Occupancy_s_name = dir_sum_track + "SummaryOccupancy_NotNorm" + sector_name;
645  std::string PanelId_name = dir_sum_track + "SummaryPanelID" + sector_name;
646 
647  // distribution plot per sector
648  std::string EffSecDist_name = dir_sum_track + "SummaryEffDistriPerSector" + sector_name;
649  std::string GapEffSecDist_name = dir_sum_track + "SummaryGapEffDistriPerSector" + sector_name;
650  std::string NoiseCorrSecDist_name = dir_sum_track + "SummaryNoiseCorrDistriPerSector" + sector_name;
651  std::string NoiseTotSecDist_name = dir_sum_track + "SummaryNoiseTotDistriPerSector" + sector_name;
652  std::string CSSecDist_name = dir_sum_track + "SummaryCSDistriPerSector" + sector_name;
653  std::string Res_CS1SecDist_name = dir_sum_track + "SummaryRes_CS1DistriPerSector" + sector_name;
654  std::string Res_CS2SecDist_name = dir_sum_track + "SummaryRes_CS2DistriPerSector" + sector_name;
655  std::string Res_CSmore2SecDist_name = dir_sum_track + "SummaryRes_CSmore2DistriPerSector" + sector_name;
656  std::string Res_CS1_rmsSecDist_name = dir_sum_track + "SummaryRes_CS1rmsDistriPerSector" + sector_name;
657  std::string Res_CS2_rmsSecDist_name = dir_sum_track + "SummaryRes_CS2rmsDistriPerSector" + sector_name;
658  std::string Res_CSmore2_rmsSecDist_name = dir_sum_track + "SummaryRes_CSmore2rmsDistriPerSector" +
659  sector_name;
660  std::string TimeSecDist_name = dir_sum_track + "SummaryTimeDistriPerSector" + sector_name;
661  std::string OccupancySecDist_name = dir_sum_track + "SummaryOccupancyDistriPerSector" + sector_name;
662  //
663  auto initialiseHisto = [f](const std::string& name) -> TH1F* {
664  TH1F* result = (TH1F*) (f->Get(name.c_str()));
665 
666  return result;
667  };
668  TH1F* h_TrackProj = initialiseHisto(TrackProj_name);
669  TH1F* h_HitOnTrack = initialiseHisto(HitOnTrack_name);
670  TH1F* h_HitOnTrackCross = initialiseHisto(HitOnTrackCross_name);
671  TH1F* h_Eff = initialiseHisto(Eff_name);
672  TH1F* h_GapEff = initialiseHisto(GapEff_name);
673  TH1F* h_NoiseCorr = initialiseHisto(NoiseCorr_name);
674  TH1F* h_NoiseCorr_s = initialiseHisto(NoiseCorr_s_name);
675  TH1F* h_NoiseTot = initialiseHisto(NoiseTot_name);
676  TH1F* h_NoiseTot_s = initialiseHisto(NoiseTot_s_name);
677  TH1F* h_Res_CS1 = initialiseHisto(Res_CS1_name);
678  TH1F* h_Res_CS1_s = initialiseHisto(Res_CS1_s_name);
679  TH1F* h_Res_CS1_square = initialiseHisto(Res_CS1_square_name);
680  TH1F* h_Res_CS1_entries = initialiseHisto(Res_CS1_entries_name);
681  TH1F* h_Res_CS2 = initialiseHisto(Res_CS2_name);
682  TH1F* h_Res_CS2_s = initialiseHisto(Res_CS2_s_name);
683  TH1F* h_Res_CS2_square = initialiseHisto(Res_CS2_square_name);
684  TH1F* h_Res_CS2_entries = initialiseHisto(Res_CS2_entries_name);
685  TH1F* h_Res_CSmore2 = initialiseHisto(Res_CSmore2_name);
686  TH1F* h_Res_CSmore2_s = initialiseHisto(Res_CSmore2_s_name);
687  TH1F* h_Res_CSmore2_square = initialiseHisto(Res_CSmore2_square_name);
688  TH1F* h_Res_CSmore2_entries = initialiseHisto(Res_CSmore2_entries_name);
689  TH1F* h_CS = initialiseHisto(CS_name);
690  TH1F* h_CS_s = initialiseHisto(CS_s_name);
691  TH1F* h_CS_square = initialiseHisto(CS_square_name);
692  TH1F* h_CS_entries = initialiseHisto(CS_square_name);
693  TH1F* h_CS1_entries = initialiseHisto(CS1_entries_name);
694  TH1F* h_CS2_entries = initialiseHisto(CS2_entries_name);
695  TH1F* h_Time = initialiseHisto(Time_name);
696  TH1F* h_Time_s = initialiseHisto(Time_s_name);
697  TH1F* h_Time_square = initialiseHisto(Time_square_name);
698  TH1F* h_Occupancy = initialiseHisto(Occupancy_name);
699  TH1F* h_Occupancy_s = initialiseHisto(Occupancy_s_name);
700  TH1F* h_PanelId = initialiseHisto(PanelId_name);
701 
702  TH1F* h_EffSecDist = initialiseHisto(EffSecDist_name);
703  TH1F* h_GapEffSecDist = initialiseHisto(GapEffSecDist_name);
704  TH1F* h_NoiseCorrSecDist = initialiseHisto(NoiseCorrSecDist_name);
705  TH1F* h_NoiseTotSecDist = initialiseHisto(NoiseTotSecDist_name);
706  TH1F* h_CSSecDist = initialiseHisto(CSSecDist_name);
707  TH1F* h_Res_CS1SecDist = initialiseHisto(Res_CS1SecDist_name);
708  TH1F* h_Res_CS2SecDist = initialiseHisto(Res_CS2SecDist_name);
709  TH1F* h_Res_CSmore2SecDist = initialiseHisto(Res_CSmore2SecDist_name);
710  TH1F* h_Res_CS1_rmsSecDist = initialiseHisto(Res_CS1_rmsSecDist_name);
711  TH1F* h_Res_CS2_rmsSecDist = initialiseHisto(Res_CS2_rmsSecDist_name);
712  TH1F* h_Res_CSmore2_rmsSecDist = initialiseHisto(Res_CSmore2_rmsSecDist_name);
713  TH1F* h_TimeSecDist = initialiseHisto(TimeSecDist_name);
714  TH1F* h_OccupancySecDist = initialiseHisto(OccupancySecDist_name);
715 
716  auto resetIfValid = [](TH1F* pH) -> void {
717  if (pH) pH->Reset();
718  return;
719  };
720  resetIfValid(h_EffSecDist);
721  resetIfValid(h_GapEffSecDist);
722  resetIfValid(h_NoiseCorrSecDist);
723  resetIfValid(h_NoiseTotSecDist);
724  resetIfValid(h_CSSecDist);
725  resetIfValid(h_Res_CS1SecDist);
726  resetIfValid(h_Res_CS2SecDist);
727  resetIfValid(h_Res_CSmore2SecDist);
728  resetIfValid(h_Res_CS1_rmsSecDist);
729  resetIfValid(h_Res_CS2_rmsSecDist);
730  resetIfValid(h_Res_CSmore2_rmsSecDist);
731  resetIfValid(h_TimeSecDist);
732  resetIfValid(h_OccupancySecDist);
733  resetIfValid(h_Eff);
734 
735  // efficiency
736  if (h_TrackProj && h_HitOnTrack && h_Eff) {
737  for (int ib = 0; ib != h_TrackProj->GetNbinsX(); ib++) {
738  if (not panelOk(h_PanelId, ib)) continue;
739  n_hit_f = h_HitOnTrack->GetBinContent(ib + 1);
740  n_tr_p = h_TrackProj->GetBinContent(ib + 1);
741 
742  //if ( n_tr_p>50 ) {
743  if (n_tr_p != 0) {
744  panel_eff = n_hit_f / n_tr_p;
745  } else {
746  panel_eff = 0.;
747  }
748  if (n_tr_p != 0) {
749  panel_err_eff = sqrt(fabs(n_hit_f) / n_tr_p) *
750  sqrt(1. - fabs(n_hit_f) / n_tr_p) /
751  sqrt(n_tr_p);
752  } else {
753  panel_err_eff = 0.;
754  }
755  h_Eff->SetBinContent(ib + 1, panel_eff);
756  h_Eff->SetBinError(ib + 1, panel_err_eff);
757  if (h_EffSecDist) h_EffSecDist->Fill(panel_eff);
758  bool aSide = isASide(h_TrackProj, ib);
759  fillAorC(aSide, h_AverageEff_A, h_AverageEff_C, panel_eff);
760  }
761  // write out histogram
762  TDirectory* dir = f->GetDirectory(dir_sum_track.c_str());
763  writeToFile(dir, h_Eff, h_EffSecDist);
764  }
765 
766  // gap efficiency
767  if (h_TrackProj && h_HitOnTrack && h_HitOnTrackCross && h_GapEff) {
768  h_GapEff->Reset();
769  nEta = 0;
770  nPhi = 0;
771  nEtaPhi = 0;
772  int sign = 1;
773  int bmin = 0;
774  bmin = int( h_GapEff->GetXaxis()->GetXmin());
775  for (int ib = 0; ib != h_TrackProj->GetNbinsX(); ib++) {
776  if (not panelOk(h_PanelId, ib)) continue;
777 
778  if ((bmin + ib) % 2 != 0) continue; // Phi panel
779  sign = std::copysign(1, (bmin + ib));
780 
781  nEta = h_HitOnTrack->GetBinContent(ib + 1);
782  nPhi = h_HitOnTrack->GetBinContent(ib + 1 + sign);
783  nEtaPhi = h_HitOnTrackCross->GetBinContent(ib + 1);
784  n_tr_p = h_TrackProj->GetBinContent(ib + 1);
785 
786  if (n_tr_p > 0) {
787  gapEff = (nEta + nPhi - nEtaPhi) / n_tr_p;
788  gapErrEff = sqrt(fabs(nEta + nPhi - nEtaPhi) / n_tr_p) *
789  sqrt(1. - fabs(nEta + nPhi - nEtaPhi) / n_tr_p) /
790  sqrt(n_tr_p);
791  } else {
792  gapEff = 0.;
793  gapErrEff = 0.;
794  }
795  h_GapEff->SetBinContent(ib + 1, gapEff);
796  h_GapEff->SetBinError(ib + 1, gapErrEff);
797  const bool isA = isASide(h_TrackProj, ib);
798  fillAorC(isA, h_AverageGapEff_A, h_AverageGapEff_C, gapEff);
799  fillIfValid(h_GapEffSecDist, gapEff);
800  }
801  TDirectory* dir = f->GetDirectory(dir_sum_track.c_str());
802  writeToFile(dir, h_GapEff, h_GapEffSecDist);
803  }
804 
805 
806  //residuals CS = 1
807  res_mean = 0;
808  res2_mean = 0;
809  res_RMS = 0;
810 
811  if (h_Res_CS1 && h_Res_CS1_s && h_Res_CS1_square && h_Res_CS1_entries) {
812  for (int ib = 0; ib != h_Res_CS1->GetNbinsX(); ib++) {
813  if (not panelOk(h_PanelId, ib)) continue;
814  if ((h_Res_CS1_entries->GetBinContent(ib + 1)) != 0) {
815  res_mean = (h_Res_CS1_s->GetBinContent(ib + 1)) / (h_Res_CS1_entries->GetBinContent(ib + 1));
816  res2_mean = (h_Res_CS1_square->GetBinContent(ib + 1)) / (h_Res_CS1_entries->GetBinContent(ib + 1));
817  res_RMS = sqrt((fabs(res2_mean - res_mean * res_mean)) / (h_Res_CS1_entries->GetBinContent(ib + 1)));
818  h_Res_CS1->SetBinContent(ib + 1, res_mean);
819  h_Res_CS1->SetBinError(ib + 1, res_RMS);
820  fillIfValid(h_Res_CS1SecDist, res_mean);
821  fillIfValid(h_Res_CS1_rmsSecDist, res_RMS);
822  bool isA = isASide(h_Res_CS1, ib);
823  fillAorC(isA, h_AverageRes_CS1_A, h_AverageRes_CS1_C, res_mean);
824  fillAorC(isA, h_AverageRes_CS1rms_A, h_AverageRes_CS1rms_C, res_RMS);
825  }
826  } // end for bins
827  TDirectory* dirRes1 = f->GetDirectory(dir_sum_track.c_str());
828  writeToFile(dirRes1, h_Res_CS1, h_Res_CS1SecDist, h_Res_CS1_rmsSecDist);
829  }
830 
831  //residuals CS = 2
832  res_mean = 0;
833  res2_mean = 0;
834  res_RMS = 0;
835  if (h_Res_CS2 && h_Res_CS2_s && h_Res_CS2_square && h_Res_CS2_entries) {
836  for (int ib = 0; ib != h_Res_CS2->GetNbinsX(); ib++) {
837  if (not panelOk(h_PanelId, ib)) continue;
838  if ((h_Res_CS2_entries->GetBinContent(ib + 1)) != 0) {
839  res_mean = (h_Res_CS2_s->GetBinContent(ib + 1)) / (h_Res_CS2_entries->GetBinContent(ib + 1));
840  res2_mean = (h_Res_CS2_square->GetBinContent(ib + 1)) / (h_Res_CS2_entries->GetBinContent(ib + 1));
841  res_RMS = sqrt(fabs((res2_mean - res_mean * res_mean) / (h_Res_CS2_entries->GetBinContent(ib + 1))));
842  h_Res_CS2->SetBinContent(ib + 1, res_mean);
843  h_Res_CS2->SetBinError(ib + 1, res_RMS);
844  fillIfValid(h_Res_CS2SecDist, res_mean);
845  fillIfValid(h_Res_CS2_rmsSecDist, res_RMS);
846  bool isA = isASide(h_Res_CS2, ib);
847  fillAorC(isA, h_AverageRes_CS2_A, h_AverageRes_CS2_C, res_mean);
848  fillAorC(isA, h_AverageRes_CS2rms_A, h_AverageRes_CS2rms_C, res_RMS);
849  }
850  }
851  TDirectory* dirRes2 = f->GetDirectory(dir_sum_track.c_str());
852  writeToFile(dirRes2, h_Res_CS2, h_Res_CS2SecDist, h_Res_CS2_rmsSecDist);
853  }
854 
855  //residuals CS > 2
856  res_mean = 0;
857  res2_mean = 0;
858  res_RMS = 0;
859  if (h_Res_CSmore2 && h_Res_CSmore2_s && h_Res_CSmore2_square && h_Res_CSmore2_entries) {
860  for (int ib = 0; ib != h_Res_CSmore2->GetNbinsX(); ib++) {
861  if (not panelOk(h_PanelId, ib)) continue;
862  if ((h_Res_CSmore2_entries->GetBinContent(ib + 1)) != 0) {
863  res_mean = (h_Res_CSmore2_s->GetBinContent(ib + 1)) / (h_Res_CSmore2_entries->GetBinContent(ib + 1));
864  res2_mean = (h_Res_CSmore2_square->GetBinContent(ib + 1)) /
865  (h_Res_CSmore2_entries->GetBinContent(ib + 1));
866  res_RMS = sqrt(fabs((res2_mean - res_mean * res_mean) / (h_Res_CSmore2_entries->GetBinContent(
867  ib + 1))));
868 
869  h_Res_CSmore2->SetBinContent(ib + 1, res_mean);
870  h_Res_CSmore2->SetBinError(ib + 1, res_RMS);
871  fillIfValid(h_Res_CSmore2SecDist, res_mean);
872  fillIfValid(h_Res_CSmore2_rmsSecDist, res_RMS);
873  bool isA = isASide(h_Res_CSmore2, ib);
874  fillAorC(isA, h_AverageRes_CSmore2_A, h_AverageRes_CSmore2_C, res_mean);
875  fillAorC(isA, h_AverageRes_CSmore2rms_A, h_AverageRes_CSmore2rms_C, res_RMS);
876  }
877  }
878  TDirectory* dirResp2 = f->GetDirectory(dir_sum_track.c_str());
879  writeToFile(dirResp2, h_Res_CSmore2, h_Res_CSmore2SecDist, h_Res_CSmore2_rmsSecDist);
880  }
881 
882  // occupancy
883  if ((rpc_eventstotal > 0) && h_Occupancy && h_Occupancy_s) {
884  for (int ib = 0; ib != h_Occupancy->GetNbinsX(); ib++) {
885  if (not panelOk(h_PanelId, ib)) continue;
886  panel_occ = h_Occupancy_s->GetBinContent(ib + 1);
887  panel_occ = panel_occ / float(rpc_eventstotal);
888 
889  h_Occupancy->SetBinContent(ib + 1, panel_occ);
890  h_Occupancy->SetBinError(ib + 1, sqrt(panel_occ));
891  panel_occ = safelyTakeLog(panel_occ);
892  fillIfValid(h_OccupancySecDist, panel_occ);
893  bool isA = isASide(h_PanelId, ib);
894  fillAorC(isA, h_AverageOccupancy_A, h_AverageOccupancy_C, panel_occ);
895  }
896  // write occupancy histograms
897  TDirectory* dirOcc = f->GetDirectory(dir_sum_track.c_str());
898  writeToFile(dirOcc, h_Occupancy, h_OccupancySecDist);
899  }
900 
901 
902  // CS
903  if (h_CS && h_CS_s && h_CS_square && h_CS_entries) {
904  for (int ib = 0; ib != h_CS->GetNbinsX(); ib++) {
905  if (not panelOk(h_PanelId, ib)) continue;
906  panelCS_entries = h_CS_entries->GetBinContent(ib + 1);
907  panelCS = h_CS_s->GetBinContent(ib + 1);
908  panelCS2 = h_CS_square->GetBinContent(ib + 1);
909  if (panelCS_entries != 0) {
910  panelCS_mean = panelCS / panelCS_entries;
911  panelCS2_mean = panelCS2 / panelCS_entries;
912  panelCS_RMS = sqrt(fabs((panelCS2_mean - panelCS_mean * panelCS_mean) / panelCS_entries));
913  h_CS->SetBinContent(ib + 1, panelCS_mean);
914  h_CS->SetBinError(ib + 1, panelCS_RMS);
915  fillIfValid(h_CSSecDist, panelCS_mean);
916  bool isA = isASide(h_CS, ib);
917  fillAorC(isA, h_AverageCS_A, h_AverageCS_C, panelCS_mean);
918  }
919  }
920  // write CS histograms
921  TDirectory* dirCS = f->GetDirectory(dir_sum_track.c_str());
922  writeToFile(dirCS, h_CS, h_CSSecDist);
923  }
924 
925  // time
926  if (h_Time && h_Time_s && h_Time_square && h_CS_entries) {
927  for (int ib = 0; ib != h_Time->GetNbinsX(); ib++) {
928  if (not panelOk(h_PanelId, ib)) continue;
929  if (h_CS_entries->GetBinContent(ib + 1) != 0) {
930  Time_mean = (h_Time_s->GetBinContent(ib + 1)) / (h_CS_entries->GetBinContent(ib + 1));
931  Time2_mean = (h_Time_square->GetBinContent(ib + 1)) / (h_CS_entries->GetBinContent(ib + 1));
932  Time_RMS = sqrt(fabs((Time2_mean - Time_mean * Time_mean) / (h_CS_entries->GetBinContent(ib + 1))));
933 
934  h_Time->SetBinContent(ib + 1, Time_mean);
935  h_Time->SetBinError(ib + 1, Time_RMS);
936 
937  fillIfValid(h_TimeSecDist, Time_mean);
938  bool isA = isASide(h_Time, ib);
939  fillAorC(isA, h_AverageTime_A, h_AverageTime_C, Time_mean);
940  }
941  }
942  // write time histograms
943  TDirectory* dirTime = f->GetDirectory(dir_sum_track.c_str());
944  writeToFile(dirTime, h_Time, h_TimeSecDist);
945  }
946  // noise
947  noiseErrNorm = 18257.42;
948  if ((rpc_eventstotal > 0) && h_NoiseCorr && h_NoiseCorr_s && h_NoiseTot && h_NoiseTot_s && h_CS_entries) {
949  //std::cout << " Taglio Eventi " << std::endl;
950  for (int ib = 0; ib != h_NoiseCorr->GetNbinsX(); ib++) {
951  if (not panelOk(h_PanelId, ib)) continue;
952  if (h_CS_entries->GetBinContent(ib + 1) == 0) continue;
953  noiseCorr = h_NoiseCorr_s->GetBinContent(ib + 1);
954  noiseCorrErr = sqrt(noiseCorr) * noiseErrNorm / float(rpc_eventstotal);
955  noiseCorr = (noiseCorr * 1000000) / float(rpc_eventstotal);
956  h_NoiseCorr->SetBinContent(ib + 1, noiseCorr);
957  h_NoiseCorr->SetBinError(ib + 1, noiseCorrErr);
958  fillIfValid(h_NoiseCorrSecDist, noiseCorr);
959 
960  noiseTot = h_NoiseTot_s->GetBinContent(ib + 1);
961  noiseTotErr = sqrt(noiseTot) * noiseErrNorm / float(rpc_eventstotal);
962  noiseTot = (noiseTot * 1000000) / float(rpc_eventstotal);
963  h_NoiseTot->SetBinContent(ib + 1, noiseTot);
964  h_NoiseTot->SetBinError(ib + 1, noiseTotErr);
965 
966  fillIfValid(h_NoiseTotSecDist, noiseTot);
967  bool isA = isASide(h_NoiseCorr, ib);
968  fillAorC(isA, h_AverageNoiseTot_A, h_AverageNoiseTot_C, noiseTot);
969  fillAorC(isA, h_AverageNoiseCorr_A, h_AverageNoiseCorr_C, noiseCorr);
970  }
971  TDirectory* dirNoise = f->GetDirectory(dir_sum_track.c_str());
972  if (dirNoise != 0) {
973  dirNoise->cd();
974  h_NoiseCorr->Write("", TObject::kOverwrite);
975  h_NoiseTot->Write("", TObject::kOverwrite);
976  writeIfValid(h_NoiseCorrSecDist);
977  writeIfValid(h_NoiseTotSecDist);
978  }
979  }
980 
981 
983  // bool do_asciiCoolFile1 = true;
984  float effeta = -9999;
985  float effphi = -9999;
986  char arr_effeta [14] = {};
987  char arr_effphi [14] = {};
988  float erreffeta = -1;
989  float erreffphi = -1;
990  char arr_erreffeta [14] = {};
991  char arr_erreffphi [14] = {};
992  float reseta_cs1 = -9999;
993  float resphi_cs1 = -9999;
994  char arr_reseta_cs1 [14] = {};
995  char arr_resphi_cs1 [14] = {};
996  float errreseta_cs1 = -1;
997  float errresphi_cs1 = -1;
998  char arr_errreseta_cs1 [14] = {};
999  char arr_errresphi_cs1 [14] = {};
1000  float reseta_cs2 = -9999;
1001  float resphi_cs2 = -9999;
1002  char arr_reseta_cs2 [14] = {};
1003  char arr_resphi_cs2 [14] = {};
1004  float errreseta_cs2 = -1;
1005  float errresphi_cs2 = -1;
1006  char arr_errreseta_cs2 [14] = {};
1007  char arr_errresphi_cs2 [14] = {};
1008  float reseta_csother = -9999;
1009  float resphi_csother = -9999;
1010  char arr_reseta_csother [14] = {};
1011  char arr_resphi_csother [14] = {};
1012  float errreseta_csother = -1;
1013  float errresphi_csother = -1;
1014  char arr_errreseta_csother [14] = {};
1015  char arr_errresphi_csother [14] = {};
1016  float timeeta = -9999;
1017  float timephi = -9999;
1018  char arr_timeeta [14] = {};
1019  char arr_timephi [14] = {};
1020  float errtimeeta = -1;
1021  float errtimephi = -1;
1022  char arr_errtimeeta [14] = {};
1023  char arr_errtimephi [14] = {};
1024  float noiseeta = -9999;
1025  float noisephi = -9999;
1026  char arr_noiseeta [14] = {};
1027  char arr_noisephi [14] = {};
1028  float errnoiseeta = -1;
1029  float errnoisephi = -1;
1030  char arr_errnoiseeta [14] = {};
1031  char arr_errnoisephi [14] = {};
1032  float noiseeta_cor = -9999;
1033  float noisephi_cor = -9999;
1034  char arr_noiseeta_cor [14] = {};
1035  char arr_noisephi_cor [14] = {};
1036  float errnoiseeta_cor = -1;
1037  float errnoisephi_cor = -1;
1038  char arr_errnoiseeta_cor [14] = {};
1039  char arr_errnoisephi_cor [14] = {};
1040  float cl_sizeeta = -9999;
1041  float cl_sizephi = -9999;
1042  char arr_cl_sizeeta [14] = {};
1043  char arr_cl_sizephi [14] = {};
1044  float errcl_sizeeta = -1;
1045  float errcl_sizephi = -1;
1046  char arr_errcl_sizeeta [14] = {};
1047  char arr_errcl_sizephi [14] = {};
1048 
1049  float eta_effphi = 0;
1050  float phi_effeta = 0;
1051 
1052  int PanelCode = 0;
1053  int Binposition = 0;
1054  int TableVersion = 1; //Version of Cool Table Formatting according with Andrea Di Simone Table
1055  int n_tr_peta = 0; //Number of eta tracks reconstructed on a gas volume
1056  int n_tr_pphi = 0; //Number of phi tracks reconstructed on a gas volume
1057  int NumberOfInfo = 1; //Number of information for each variable 1= only pannel, >1 depending on tipy of
1058  // monitoring setting and strip pannel geometry
1059  int StripCluster = 0; //Number of strip that realize de reduction bin and the strip pannel geometry 0=no
1060  // strip info,if panel has 24 strip: 24=strip info, 3 = cluster of 8 strip, 6 =
1061  // cluster of 4 strip and so on
1062 
1063 
1064 
1065  coolrpc.coolDbFolder("sqlite://;schema=RPCDQMFOFFLINE.db;dbname=RPC_DQA", "/OFFLINE/OFFLINE_DQMF");
1066  int nbin = 0;
1067  if (h_Eff) nbin = h_Eff->GetNbinsX();
1068  auto writeToCString = [](float val, char* array0) -> void {
1069  //following two lines reproduce original behaviour
1070  sprintf(array0, "%f ", val); //unsafe!
1071  array0[5] = 0; //ugh!
1072  };
1073 
1074  for (int ibin = 1; ibin != nbin + 1; ibin++) {
1075  if (h_PanelId) PanelCode = (int) h_PanelId->GetBinContent(ibin);
1076  if (PanelCode == 0) continue;
1077  if (ibin % 2 == 0) {
1078  if (h_TrackProj) n_tr_pphi = (int) h_TrackProj->GetBinContent(ibin);
1079  if (n_tr_pphi < 1000) continue;
1080 
1081  effphi = getBinContentIfValid(h_Eff, ibin);
1082  writeToCString(effphi, arr_effphi);
1083  erreffphi = getBinErrorIfValid(h_Eff, ibin);
1084  writeToCString(erreffphi, arr_erreffphi);
1085 
1086  resphi_cs1 = getBinContentIfValid(h_Res_CS1, ibin);
1087  writeToCString(resphi_cs1, arr_resphi_cs1);
1088  errresphi_cs1 = getBinErrorIfValid(h_Res_CS1, ibin);
1089  writeToCString(errresphi_cs1, arr_errresphi_cs1);
1090 
1091  resphi_cs2 = getBinContentIfValid(h_Res_CS2, ibin);
1092  writeToCString(resphi_cs2, arr_resphi_cs2);
1093  errresphi_cs2 = getBinErrorIfValid(h_Res_CS2, ibin);
1094  writeToCString(errresphi_cs2, arr_errresphi_cs2);
1095 
1096  resphi_csother = getBinContentIfValid(h_Res_CSmore2, ibin);
1097  writeToCString(resphi_csother, arr_resphi_csother);
1098  errresphi_csother = getBinErrorIfValid(h_Res_CSmore2, ibin);
1099  writeToCString(errresphi_csother, arr_errresphi_csother);
1100 
1101  timephi = getBinContentIfValid(h_Time, ibin);
1102  writeToCString(timephi, arr_timephi);
1103  errtimephi = getBinErrorIfValid(h_Time, ibin);
1104  writeToCString(errtimephi, arr_errtimephi);
1105 
1106  noisephi = getBinContentIfValid(h_NoiseTot, ibin);
1107  writeToCString(noisephi, arr_noisephi);
1108  errnoisephi = getBinErrorIfValid(h_NoiseTot, ibin);
1109  writeToCString(errnoisephi, arr_errnoisephi);
1110 
1111  noisephi_cor = getBinContentIfValid(h_NoiseCorr, ibin);
1112  writeToCString(noisephi_cor, arr_noisephi_cor);
1113  errnoisephi_cor = getBinErrorIfValid(h_NoiseCorr, ibin);
1114  writeToCString(errnoisephi_cor, arr_errnoisephi_cor);
1115 
1116  cl_sizephi = getBinContentIfValid(h_CS, ibin);
1117  writeToCString(cl_sizephi, arr_cl_sizephi);
1118  errcl_sizephi = getBinErrorIfValid(h_CS, ibin);
1119  writeToCString(errcl_sizephi, arr_errcl_sizephi);
1120  } else {
1121  if (h_TrackProj) {
1122  n_tr_peta = (int) h_TrackProj->GetBinContent(ibin);
1123  }
1124  if (n_tr_peta < 1000) continue;
1125 
1126  effeta = getBinContentIfValid(h_Eff, ibin);
1127  writeToCString(effeta, arr_effeta);
1128  erreffeta = getBinErrorIfValid(h_Eff, ibin);
1129  writeToCString(erreffeta, arr_erreffeta);
1130 
1131  reseta_cs1 = getBinContentIfValid(h_Res_CS1, ibin);
1132  writeToCString(reseta_cs1, arr_reseta_cs1);
1133  errreseta_cs1 = getBinErrorIfValid(h_Res_CS1, ibin);
1134  writeToCString(errreseta_cs1, arr_errreseta_cs1);
1135 
1136  reseta_cs2 = getBinContentIfValid(h_Res_CS2, ibin);
1137  writeToCString(reseta_cs2, arr_reseta_cs2);
1138  errreseta_cs2 = getBinErrorIfValid(h_Res_CS2, ibin);
1139  writeToCString(errreseta_cs2, arr_errreseta_cs2);
1140 
1141  reseta_csother = getBinContentIfValid(h_Res_CSmore2, ibin);
1142  writeToCString(reseta_csother, arr_reseta_csother);
1143  errreseta_csother = getBinErrorIfValid(h_Res_CSmore2, ibin);
1144  writeToCString(errreseta_csother, arr_errreseta_csother);
1145 
1146  timeeta = getBinContentIfValid(h_Time, ibin);
1147  writeToCString(timeeta, arr_timeeta);
1148  errtimeeta = getBinErrorIfValid(h_Time, ibin);
1149  writeToCString(errtimeeta, arr_errtimeeta);
1150 
1151  noiseeta = getBinContentIfValid(h_NoiseTot, ibin);
1152  writeToCString(noiseeta, arr_noiseeta);
1153  errnoiseeta = getBinErrorIfValid(h_NoiseTot, ibin);
1154  writeToCString(errnoiseeta, arr_errnoiseeta);
1155 
1156  noiseeta_cor = getBinContentIfValid(h_NoiseCorr, ibin);
1157  writeToCString(noiseeta_cor, arr_noiseeta_cor);
1158  errnoiseeta_cor = getBinErrorIfValid(h_NoiseCorr, ibin);
1159  writeToCString(errnoiseeta_cor, arr_errnoiseeta_cor);
1160 
1161  cl_sizeeta = getBinContentIfValid(h_CS, ibin);
1162  writeToCString(cl_sizeeta, arr_cl_sizeeta);
1163  errcl_sizeeta = getBinErrorIfValid(h_CS, ibin);
1164  writeToCString(errcl_sizeeta, arr_errcl_sizeeta);
1165 
1166 
1167  //std::cout<<"PanelCode "<<PanelCode<<" etaprimo "<<"\n";
1168 
1169  char recEta [4000]; //eff_eta, res_cs1, res_cs2, res_csother, time, mean and rms
1170  char detEta [4000]; //noise, noise_corr, cs, mean and rms
1171  char recPhi1 [4000]; //eff_phi, res_cs1, res_cs2, res_csother, time, only mean
1172  char recPhi2 [4000]; //eff_phi, res_cs1, res_cs2, res_csother, time, only rms
1173  char detPhi1 [4000]; //noise, noise_corr, cs, mean and rms
1174  char detPhi2 [4000];
1175  sprintf(recEta, "%5d %5d %5d %5d %s %s %s %s %s %s %s %s %s %s ", TableVersion,
1176  n_tr_peta, NumberOfInfo, StripCluster, arr_effeta, arr_erreffeta, arr_reseta_cs1,
1177  arr_errreseta_cs1, arr_reseta_cs2, arr_errreseta_cs2, arr_reseta_csother,
1178  arr_errreseta_csother, arr_timeeta, arr_errtimeeta);
1179  sprintf(detEta, "%s %s %s %s %s %s ", arr_noiseeta, arr_errnoiseeta,
1180  arr_noiseeta_cor, arr_errnoiseeta_cor, arr_cl_sizeeta, arr_errcl_sizeeta);
1181  sprintf(recPhi1, "%5d %5d %5d %s %s %s %s %s ", n_tr_pphi, NumberOfInfo,
1182  StripCluster, arr_effphi, arr_resphi_cs1, arr_resphi_cs2, arr_resphi_csother,
1183  arr_timephi);
1184  sprintf(recPhi2, "%s %s %s %s %s ", arr_erreffphi, arr_errresphi_cs1,
1185  arr_errresphi_cs2, arr_errresphi_csother, arr_errtimephi);
1186  sprintf(detPhi1, "%s %s %s %s %s %s ", arr_noisephi, arr_errnoisephi,
1187  arr_noisephi_cor, arr_errnoisephi_cor, arr_cl_sizephi, arr_errcl_sizephi);
1188  sprintf(detPhi2, "0 ");
1189  std::string cool_tag = "Reco";
1190  coolrpc.setSince(0U, 0U);
1191  coolrpc.setUntil(4294967295U, 0U);
1192  coolrpc.insert_withTag(run_number * 0 + 429496729U, PanelCode, recEta, detEta, recPhi1, recPhi2,
1193  detPhi1, detPhi2, cool_tag);
1194  }
1195  }
1196 
1199 
1200  int TableVersionCondDB = 2; //RPC conditionDB table versioning
1201  float gapeffeta = -9999;
1202  char arr_gapeffeta [10];
1203  float errgapeffeta = -1;
1204  char arr_errgapeffeta [10];
1205  float gapeffphi = -9999;
1206  char arr_gapeffphi [10];
1207  float errgapeffphi = -1;
1208  char arr_errgapeffphi [10];
1209  float gapeff = -9999;
1210  float errgapeff = -1;
1211  float entriesCSeta = -1;
1212  int entriesCS1eta = -1;
1213  int entriesCS2eta = -1;
1214  float entriesCSphi = -1;
1215  int entriesCS1phi = -1;
1216  int entriesCS2phi = -1;
1217  float rateCS1eta = -1;
1218  char arr_rateCS1eta [10];
1219  float rateCS2eta = -1;
1220  char arr_rateCS2eta [10];
1221  float rateCSmore2eta = -1;
1222  char arr_rateCSmore2eta [10];
1223  float rateCS1phi = -1;
1224  char arr_rateCS1phi [10];
1225  float rateCS2phi = -1;
1226  char arr_rateCS2phi [10];
1227  float rateCSmore2phi = -1;
1228  char arr_rateCSmore2phi [10];
1229 
1230 
1231 
1232  coolrpc.coolDbFolder("sqlite://;schema=RPCConditionDB.db;dbname=RPC_DQA", "/OFFLINE/FINAL");
1233  std::string dir_cool_raw = run_dir + "/Muon/MuonRawDataMonitoring/RPC/CoolDB/";
1234  TDirectory* coolFolder = f->GetDirectory(dir_cool_raw.c_str());
1235 
1236  if (coolFolder != 0) {
1237  std::vector<std::string> layerList;
1238  layerList.push_back("LowPt0");
1239  layerList.push_back("LowPt1");
1240  layerList.push_back("Pivot0");
1241  layerList.push_back("Pivot1");
1242  layerList.push_back("HighPt0");
1243  layerList.push_back("HighPt1");
1244  int NumberLayerStrip = 0;
1245  int PanelStripId = 0;
1246  int StripProfileContenent = 0;
1247 
1248  auto stripValue=[](float occ){
1249  int stripVal = 0;
1250  if (occ == 0){
1251  stripVal = 0;
1252  } else if (occ > 0 && occ < 0.9) {
1253  stripVal = 5;
1254  } else if (occ > 0.9){
1255  stripVal = 9;
1256  }
1257  return stripVal;
1258  };
1259 
1260  for (std::vector<std::string>::const_iterator iter = layerList.begin(); iter != layerList.end(); ++iter) {
1261  for (int i_dblPhi = 0; i_dblPhi != 2 * 1 + 1; ++i_dblPhi) {
1262  char coolName[40];
1263  sprintf(coolName, "Sector%.2d_%s_dblPhi%d", i_sec + 1, (*iter).c_str(), i_dblPhi + 1);
1264  std::string stripId_name = dir_cool_raw + coolName + "_PanelId";
1265  std::string stripProfile_name = dir_cool_raw + coolName + "_Profile";
1266  TH1F* h_stripId = NULL;
1267  TH1F* h_stripProfile = NULL;
1268 
1269  if (RPCCheckHistogram(f, stripId_name.c_str())) {
1270  h_stripId = (TH1F*) (f->Get(stripId_name.c_str()));
1271  }
1272  if (RPCCheckHistogram(f, stripProfile_name.c_str())) {
1273  h_stripProfile = (TH1F*) (f->Get(stripProfile_name.c_str()));
1274  }
1275 
1276  if (h_stripId && h_stripProfile) {
1277  int SingleStripsValue = 0;
1278  int StripsOnPanel = 1; //number of strip on panel
1279  char SingleStripsStatus [80];
1280  char SingleStripsStatusOK[80];
1281  std::string PanelStripsStatus;
1282  std::string PanelStripsStatusOK;
1283 
1284  NumberLayerStrip = h_stripProfile->GetNbinsX();
1285  for (int Nstrips = 1; Nstrips != NumberLayerStrip + 1; Nstrips++) {
1286  PanelStripId = (int) h_stripId->GetBinContent(Nstrips);
1287  StripProfileContenent = (int) h_stripProfile->GetBinContent(Nstrips);
1288  float StripOccupancy = (float) (StripProfileContenent) / rpc_eventstotal;
1289  SingleStripsValue = stripValue(StripOccupancy);
1290 
1291  if (h_stripId->GetBinCenter(Nstrips) > 0) {
1292  sprintf(SingleStripsStatus, "%d 000.0 0.000|", SingleStripsValue);
1293  sprintf(SingleStripsStatusOK, "5 000.0 0.000|");
1294  } else {
1295  sprintf(SingleStripsStatus, "|000.0 0.000 %d", SingleStripsValue);
1296  sprintf(SingleStripsStatusOK, "|000.0 0.000 5");
1297  }
1298  PanelStripsStatus = PanelStripsStatus + SingleStripsStatus;
1299  PanelStripsStatusOK = PanelStripsStatusOK + SingleStripsStatusOK;
1300 
1301 
1302 
1303  if ((int) h_stripId->GetBinContent(Nstrips) ==
1304  (int) h_stripId->GetBinContent(Nstrips + 1)) StripsOnPanel++;
1305 
1306  if ((int) h_stripId->GetBinContent(Nstrips) != (int) h_stripId->GetBinContent(Nstrips + 1)) {
1307 
1308  if (h_stripId->GetBinCenter(Nstrips) < 0) {
1309  std::reverse(PanelStripsStatus.begin(), PanelStripsStatus.end());
1310  std::reverse(PanelStripsStatusOK.begin(), PanelStripsStatusOK.end());
1311  }
1312 
1313  for (int ibin = 1; ibin != nbin + 1; ibin++) {
1314  if (h_PanelId) PanelCode = (int) h_PanelId->GetBinContent(ibin);
1315  if (PanelCode != PanelStripId) continue;
1316  if (ibin % 2 != 0) {
1317  if (h_TrackProj) {
1318  n_tr_peta = (int) h_TrackProj->GetBinContent(ibin);
1319  }
1320  //if(n_tr_peta >0){
1321  if (h_PanelId) Binposition = (int) h_PanelId->GetBinCenter(ibin);
1322  int ibin_perp = (Binposition > 0) ? ibin + 1: ibin - 1;
1323  eta_effphi = getBinContentIfValid(h_Eff, ibin_perp);
1324 
1325  gapeff = getBinContentIfValid(h_GapEff, ibin);
1326  errgapeff = getBinErrorIfValid(h_GapEff, ibin);
1327  effeta = getBinContentIfValid(h_Eff, ibin);
1328  erreffeta = getBinErrorIfValid(h_Eff, ibin);
1329 
1330  gapeffeta = gapeff;
1331  errgapeffeta = errgapeff;
1332  EffThreshold = (effeta < Minimum_efficiency) || (eta_effphi < Minimum_efficiency);
1333 
1334  reseta_cs1 = getBinContentIfValid(h_Res_CS1, ibin);
1335  errreseta_cs1 = getBinErrorIfValid(h_Res_CS1, ibin);
1336 
1337  reseta_cs2 = getBinContentIfValid(h_Res_CS2, ibin);
1338  errreseta_cs2 = getBinErrorIfValid(h_Res_CS2, ibin);
1339 
1340  reseta_csother = getBinContentIfValid(h_Res_CSmore2, ibin);
1341  errreseta_csother = getBinErrorIfValid(h_Res_CSmore2, ibin);
1342 
1343  noiseeta = getBinContentIfValid(h_NoiseTot, ibin);
1344  errnoiseeta = getBinErrorIfValid(h_NoiseTot, ibin);
1345 
1346  noiseeta_cor = getBinContentIfValid(h_NoiseCorr, ibin);
1347  errnoiseeta_cor = getBinErrorIfValid(h_NoiseCorr, ibin);
1348 
1349  cl_sizeeta = getBinContentIfValid(h_CS, ibin);
1350  errcl_sizeeta = getBinErrorIfValid(h_CS, ibin);
1351 
1352  entriesCSeta = getBinContentIfValid(h_CS_entries, ibin);
1353  entriesCS1eta = getBinContentIfValid(h_CS1_entries, ibin);
1354  entriesCS2eta = getBinContentIfValid(h_CS2_entries, ibin);
1355 
1356  if (entriesCSeta > 0) {
1357  rateCS1eta = entriesCS1eta / entriesCSeta;
1358  rateCS2eta = entriesCS2eta / entriesCSeta;
1359  rateCSmore2eta = (entriesCSeta - (entriesCS1eta + entriesCS2eta)) / entriesCSeta;
1360  }
1361 
1362  if (applyEffThreshold) {
1363  if (effeta < Minimum_efficiency && eta_effphi < Minimum_efficiency) {
1364  effeta = Minimum_efficiency;
1365  gapeffeta = Minimum_efficiency;
1366  erreffeta = 0.1;
1367  errgapeffeta = 0.1;
1368  PanelStripsStatus = PanelStripsStatusOK;
1369  cl_sizeeta = 1;
1370  errcl_sizeeta = 0.1,
1371  rateCS1eta = 1;
1372  rateCS2eta = 0;
1373  rateCSmore2eta = 0;
1374  } else if (effeta < Minimum_efficiency && eta_effphi > Minimum_efficiency) {
1375  effeta = Minimum_efficiency;
1376  gapeffeta = eta_effphi;
1377  erreffeta = 0.1;
1378  errgapeffeta = 0.1;
1379  PanelStripsStatus = PanelStripsStatusOK;
1380  cl_sizeeta = 1;
1381  errcl_sizeeta = 0.1,
1382  rateCS1eta = 1;
1383  rateCS2eta = 0;
1384  rateCSmore2eta = 0;
1385  } else if (effeta > Minimum_efficiency && eta_effphi < Minimum_efficiency) {
1386  gapeffeta = effeta;
1387  errgapeffeta = 0.1;
1388  }
1389  }
1390  sprintf(arr_effeta, "%f ", effeta);
1391  arr_effeta [5] = 0;
1392  sprintf(arr_erreffeta, "%f ", erreffeta);
1393  arr_erreffeta [5] = 0;
1394  sprintf(arr_gapeffeta, "%f ", gapeffeta);
1395  arr_gapeffeta [5] = 0;
1396  sprintf(arr_errgapeffeta, "%f ", errgapeffeta);
1397  arr_errgapeffeta [5] = 0;
1398  sprintf(arr_reseta_cs1, "%f ", reseta_cs1);
1399  arr_reseta_cs1 [5] = 0;
1400  sprintf(arr_errreseta_cs1, "%f ", errreseta_cs1);
1401  arr_errreseta_cs1 [5] = 0;
1402  sprintf(arr_reseta_cs2, "%f ", reseta_cs2);
1403  arr_reseta_cs2 [5] = 0;
1404  sprintf(arr_errreseta_cs2, "%f ", errreseta_cs2);
1405  arr_errreseta_cs2 [5] = 0;
1406  sprintf(arr_reseta_csother, "%f ", reseta_csother);
1407  arr_reseta_csother [5] = 0;
1408  sprintf(arr_errreseta_csother, "%f ", errreseta_csother);
1409  arr_errreseta_csother[5] = 0;
1410  sprintf(arr_noiseeta, "%f ", noiseeta);
1411  arr_noiseeta [5] = 0;
1412  sprintf(arr_errnoiseeta, "%f ", errnoiseeta);
1413  arr_errnoiseeta [5] = 0;
1414  sprintf(arr_noiseeta_cor, "%f ", noiseeta_cor);
1415  arr_noiseeta_cor [5] = 0;
1416  sprintf(arr_errnoiseeta_cor, "%f ", errnoiseeta_cor);
1417  arr_errnoiseeta_cor [5] = 0;
1418  sprintf(arr_cl_sizeeta, "%f ", cl_sizeeta);
1419  arr_cl_sizeeta [5] = 0;
1420  sprintf(arr_errcl_sizeeta, "%f ", errcl_sizeeta);
1421  arr_errcl_sizeeta [5] = 0;
1422  sprintf(arr_rateCS1eta, "%f ", rateCS1eta);
1423  arr_rateCS1eta [5] = 0;
1424  sprintf(arr_rateCS2eta, "%f ", rateCS2eta);
1425  arr_rateCS2eta [5] = 0;
1426  sprintf(arr_rateCSmore2eta, "%f ", rateCSmore2eta);
1427  arr_rateCSmore2eta [5] = 0;
1428 
1429  char PanelRes [255]; //eff_eta, res_cs1, res_cs2, res_csother, time, mean and rms
1430  char StripStatus [4096]; //strips status 0 to 9 for dead noisy strips
1431 
1432  sprintf(PanelRes, "%d %d %d %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
1433  TableVersionCondDB, n_tr_peta, StripsOnPanel, arr_effeta, arr_erreffeta,
1434  arr_gapeffeta, arr_errgapeffeta, arr_reseta_cs1, arr_errreseta_cs1, arr_reseta_cs2,
1435  arr_errreseta_cs2, arr_reseta_csother, arr_errreseta_csother, arr_noiseeta,
1436  arr_errnoiseeta, arr_noiseeta_cor, arr_errnoiseeta_cor, arr_cl_sizeeta,
1437  arr_errcl_sizeeta, arr_rateCS1eta, arr_rateCS2eta, arr_rateCSmore2eta);
1438  sprintf(StripStatus, "%s", PanelStripsStatus.c_str());
1439  std::string cool_tagCondDB = "RecoCondDB";
1440  coolrpc.setSince(0U, 0U);
1441  coolrpc.setUntil(4294967295U, 0U);
1442  coolrpc.insertCondDB_withTag(run_number * 0 + 429496729U, PanelCode, PanelRes, StripStatus,
1443  cool_tagCondDB);
1444  if (printout and EffThreshold and h_GapEff) std::cout << stripProfile_name <<
1445  " under THR " << EffThreshold << " " << PanelCode << " ibin " << ibin << " h_EffEta " <<
1446  h_Eff->GetBinContent(ibin) << " h_EffPhi " << h_Eff->GetBinContent(ibin_perp) <<
1447  " h_GapEffEta " << h_GapEff->GetBinContent(ibin) << " h_GapEffPhi " <<
1448  h_GapEff->GetBinContent(ibin_perp) << " cool_EtaEff " << effeta << " cool_GapEffEta " <<
1449  gapeffeta << " --- Eta Summary " << PanelRes << " --- StripStatus " << StripStatus <<
1450  std::endl;
1451  if (printout &&
1452  EffThreshold) std::cout << "inCOOL_ETA_id_ntrk_panelEff_gapEff " << PanelCode << " " <<
1453  n_tr_peta << " " << (int) (n_tr_peta * effeta) << " " << (int) (n_tr_peta * gapeffeta) <<
1454  std::endl;
1455  countpanelindb++;
1456  if (effeta == 0.0) countpaneleff0++;
1457  if (n_tr_peta == 0) countpaneltrack0++;
1458  } else {
1459  if (h_TrackProj) n_tr_pphi = (int) h_TrackProj->GetBinContent(ibin);
1460  //if(n_tr_pphi >0){
1461 
1462  if (h_PanelId) Binposition = (int) h_PanelId->GetBinCenter(ibin);
1463  int ibin_perp = (Binposition > 0) ? ibin - 1: ibin + 1;
1464  gapeff = getBinContentIfValid(h_GapEff, ibin_perp);
1465  errgapeff = getBinErrorIfValid(h_GapEff, ibin_perp);
1466  phi_effeta = getBinContentIfValid(h_Eff, ibin_perp);
1467 
1468  effphi = getBinContentIfValid(h_Eff, ibin);
1469  erreffphi = getBinErrorIfValid(h_Eff, ibin);
1470  gapeffphi = gapeff;
1471  errgapeffphi = errgapeff;
1472  EffThreshold = (effphi < Minimum_efficiency) || (phi_effeta < Minimum_efficiency);
1473 
1474 
1475  resphi_cs1 = getBinContentIfValid(h_Res_CS1, ibin);
1476  errresphi_cs1 = getBinErrorIfValid(h_Res_CS1, ibin);
1477 
1478  resphi_cs2 = getBinContentIfValid(h_Res_CS2, ibin);
1479  errresphi_cs2 = getBinErrorIfValid(h_Res_CS2, ibin);
1480 
1481  resphi_csother = getBinContentIfValid(h_Res_CSmore2, ibin);
1482  errresphi_csother = getBinErrorIfValid(h_Res_CSmore2, ibin);
1483 
1484  noisephi = getBinContentIfValid(h_NoiseTot, ibin);
1485  errnoisephi = getBinErrorIfValid(h_NoiseTot, ibin);
1486 
1487  noisephi_cor = getBinContentIfValid(h_NoiseCorr, ibin);
1488  errnoisephi_cor = getBinErrorIfValid(h_NoiseCorr, ibin);
1489 
1490  cl_sizephi = getBinContentIfValid(h_CS, ibin);
1491  errcl_sizephi = getBinErrorIfValid(h_CS, ibin);
1492 
1493  entriesCSphi = getBinContentIfValid(h_CS_entries, ibin);
1494  entriesCS1phi = getBinContentIfValid(h_CS1_entries, ibin);
1495  entriesCS2phi = getBinContentIfValid(h_CS2_entries, ibin);
1496  if (entriesCSphi > 0) {
1497  rateCS1phi = entriesCS1phi / entriesCSphi;
1498  rateCS2phi = entriesCS2phi / entriesCSphi;
1499  rateCSmore2phi = (entriesCSphi - (entriesCS1phi + entriesCS2phi)) / entriesCSphi;
1500  }
1501 
1502 
1503  if (applyEffThreshold) {
1504  if (effphi < Minimum_efficiency && phi_effeta < Minimum_efficiency) {
1505  effphi = Minimum_efficiency;
1506  gapeffphi = Minimum_efficiency;
1507  erreffphi = 0.1;
1508  errgapeffphi = 0.1;
1509  PanelStripsStatus = PanelStripsStatusOK;
1510  cl_sizephi = 1;
1511  errcl_sizephi = 0.1,
1512  rateCS1phi = 1;
1513  rateCS2phi = 0;
1514  rateCSmore2phi = 0;
1515  } else if (effphi < Minimum_efficiency && phi_effeta > Minimum_efficiency) {
1516  effphi = Minimum_efficiency;
1517  gapeffphi = phi_effeta;
1518  erreffphi = 0.1;
1519  errgapeffphi = 0.1;
1520  PanelStripsStatus = PanelStripsStatusOK;
1521  cl_sizephi = 1;
1522  errcl_sizephi = 0.1,
1523  rateCS1phi = 1;
1524  rateCS2phi = 0;
1525  rateCSmore2phi = 0;
1526  } else if (effphi > Minimum_efficiency && phi_effeta < Minimum_efficiency) {
1527  gapeffphi = effphi;
1528  errgapeffphi = 0.1;
1529  PanelStripsStatus = PanelStripsStatusOK;
1530  }
1531  }
1532 
1533  sprintf(arr_effphi, "%f ", effphi);
1534  arr_effphi [5] = 0;
1535  sprintf(arr_erreffphi, "%f ", erreffphi);
1536  arr_erreffphi [5] = 0;
1537  sprintf(arr_gapeffphi, "%f ", gapeffphi);
1538  arr_gapeffphi [5] = 0;
1539  sprintf(arr_errgapeffphi, "%f ", errgapeffphi);
1540  arr_errgapeffphi [5] = 0;
1541  sprintf(arr_resphi_cs1, "%f ", resphi_cs1);
1542  arr_resphi_cs1 [5] = 0;
1543  sprintf(arr_errresphi_cs1, "%f ", errresphi_cs1);
1544  arr_errresphi_cs1 [5] = 0;
1545  sprintf(arr_resphi_cs2, "%f ", resphi_cs2);
1546  arr_resphi_cs2 [5] = 0;
1547  sprintf(arr_errresphi_cs2, "%f ", errresphi_cs2);
1548  arr_errresphi_cs2 [5] = 0;
1549  sprintf(arr_resphi_csother, "%f ", resphi_csother);
1550  arr_resphi_csother [5] = 0;
1551  sprintf(arr_errresphi_csother, "%f ", errresphi_csother);
1552  arr_errresphi_csother[5] = 0;
1553  sprintf(arr_noisephi, "%f ", noisephi);
1554  arr_noisephi [5] = 0;
1555  sprintf(arr_errnoisephi, "%f ", errnoisephi);
1556  arr_errnoisephi [5] = 0;
1557  sprintf(arr_noisephi_cor, "%f ", noisephi_cor);
1558  arr_noisephi_cor [5] = 0;
1559  sprintf(arr_errnoisephi_cor, "%f ", errnoisephi_cor);
1560  arr_errnoisephi_cor [5] = 0;
1561  sprintf(arr_cl_sizephi, "%f ", cl_sizephi);
1562  arr_cl_sizephi [5] = 0;
1563  sprintf(arr_errcl_sizephi, "%f ", errcl_sizephi);
1564  arr_errcl_sizephi [5] = 0;
1565  sprintf(arr_rateCS1phi, "%f ", rateCS1phi);
1566  arr_rateCS1phi [5] = 0;
1567  sprintf(arr_rateCS2phi, "%f ", rateCS2phi);
1568  arr_rateCS2phi [5] = 0;
1569  sprintf(arr_rateCSmore2phi, "%f ", rateCSmore2phi);
1570  arr_rateCSmore2phi [5] = 0;
1571 
1572  char PanelRes [255]; //eff_eta, res_cs1, res_cs2, res_csother, time, mean and rms
1573  char StripStatus [4096]; //strips status 0 to 9 for dead noisy strips
1574  sprintf(PanelRes, "%d %d %d %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
1575  TableVersionCondDB, n_tr_pphi,
1576  StripsOnPanel, arr_effphi, arr_erreffphi, arr_gapeffphi, arr_errgapeffphi,
1577  arr_resphi_cs1, arr_errresphi_cs1, arr_resphi_cs2,
1578  arr_errresphi_cs2, arr_resphi_csother, arr_errresphi_csother, arr_noisephi,
1579  arr_errnoisephi, arr_noisephi_cor, arr_errnoisephi_cor,
1580  arr_cl_sizephi, arr_errcl_sizephi, arr_rateCS1phi, arr_rateCS2phi,
1581  arr_rateCSmore2phi);
1582  sprintf(StripStatus, "%s", PanelStripsStatus.c_str());
1583  std::string cool_tag = "RecoCondDB";
1584  coolrpc.setSince(0U, 0U);
1585  coolrpc.setUntil(4294967295U, 0U);
1586  coolrpc.insertCondDB_withTag(run_number * 0 + 429496729U, PanelCode, PanelRes, StripStatus,
1587  cool_tag);
1588 
1589  if (printout &&
1590  EffThreshold) std::cout << stripProfile_name << " under THR " << EffThreshold << " " <<
1591  PanelCode << " ibin " << ibin << " h_EffPhi " << h_Eff->GetBinContent(ibin)
1592  << " h_EffEta " <<
1593  h_Eff->GetBinContent(ibin_perp) << " h_GapEffPhi " << h_GapEff->GetBinContent(ibin) <<
1594  " h_GapEffEta " << h_GapEff->GetBinContent(ibin_perp) << " cool_PhiEff "
1595  << effphi << " cool_GapEffPhi " << gapeffphi <<
1596  " --- Phi Summary " << PanelRes << " --- StripStatus " << StripStatus << std::endl;
1597 
1598  if (printout && EffThreshold) std::cout << "inCOOL_PHI_id_ntrk_panelEff_gapEff " << PanelCode << " " << n_tr_pphi << " " << (int) (n_tr_pphi * effphi) << " " << (int) (n_tr_pphi * gapeffphi) << std::endl;
1599  countpanelindb++;
1600  if (effphi == 0.0) countpaneleff0++;
1601  if (n_tr_pphi == 0) countpaneltrack0++;
1602  }
1603  StripsOnPanel = 1;
1604  PanelStripsStatus.clear();
1605  PanelStripsStatusOK.clear();
1606  }
1607  StripsOnPanel = 1;
1608  PanelStripsStatus.clear();
1609  PanelStripsStatusOK.clear();
1610  }
1611  }
1612  }
1613  } // end loop on DoubletPhi
1614  } // end loop on layers
1615  }// end Cool Folder
1616  std::cout << "Count RC panels in DB " << countpanelindb << " Count RPCpanels in DB with zero efficiency " << countpaneleff0 << " Count RPCpanels in DB with zero track " << countpaneltrack0 << std::endl;
1617  } // end for sectors
1618  std::cout << "Count RC panels in DB " << countpanelindb << " Count RPCpanels in DB with zero efficiency " << countpaneleff0 << " Count RPCpanels in DB with zero track " << countpaneltrack0 << std::endl;
1619  // write distribution plots all ATLAS
1620  TDirectory* dirA = f->GetDirectory(dir_sideA_track.c_str());
1621 
1622  if (dirA != 0) {
1623  dirA->cd();
1624  writeIfValid(h_AverageEff_A);
1625  writeIfValid(h_AverageGapEff_A);
1626  writeIfValid(h_AverageRes_CS1_A);
1627  writeIfValid(h_AverageRes_CS1rms_A);
1628  writeIfValid(h_AverageRes_CS2_A);
1629  writeIfValid(h_AverageRes_CS2rms_A);
1630  writeIfValid(h_AverageRes_CSmore2_A);
1631  writeIfValid(h_AverageRes_CSmore2rms_A);
1632  writeIfValid(h_AverageOccupancy_A);
1633  writeIfValid(h_AverageCS_A);
1634  writeIfValid(h_AverageTime_A);
1635  writeIfValid(h_AverageNoiseCorr_A);
1636  writeIfValid(h_AverageNoiseTot_A);
1637  }
1638  TDirectory* dirC = f->GetDirectory(dir_sideC_track.c_str());
1639  if (dirC != 0) {
1640  dirC->cd();
1641  writeIfValid(h_AverageEff_C);
1642  writeIfValid(h_AverageGapEff_C);
1643  writeIfValid(h_AverageRes_CS1_C);
1644  writeIfValid(h_AverageRes_CS1rms_C);
1645  writeIfValid(h_AverageRes_CS2_C);
1646  writeIfValid(h_AverageRes_CS2rms_C);
1647  writeIfValid(h_AverageRes_CSmore2_C);
1648  writeIfValid(h_AverageRes_CSmore2rms_C);
1649  writeIfValid(h_AverageOccupancy_C);
1650  writeIfValid(h_AverageCS_C);
1651  writeIfValid(h_AverageTime_C);
1652  writeIfValid(h_AverageNoiseCorr_C);
1653  writeIfValid(h_AverageNoiseTot_C);
1654  }
1655  }
1656  } else {
1657  delete obj_run;
1658  } // end if tdir_run !=0
1659  }
1660  f->Close();
1661  delete f;
1662  }

◆ setCompressionLevel()

static void dqutils::MonitoringFile::setCompressionLevel ( int  level)
inlinestatic

Definition at line 459 of file MonitoringFile.h.

◆ setDebugLevel()

static void dqutils::MonitoringFile::setDebugLevel ( int  level)
static

◆ setDirectoryRegEx()

bool dqutils::MonitoringFile::setDirectoryRegEx ( const std::string &  re)

◆ setFile()

virtual bool dqutils::MonitoringFile::setFile ( const std::string &  fileName)
virtual

Clears all previous data and opens the file with the given name for analysis, returning a boolean indicating whether the file was opened successfully or not.

◆ setHistogramRegEx()

bool dqutils::MonitoringFile::setHistogramRegEx ( const std::string &  re)

◆ setListFromFile()

static bool dqutils::MonitoringFile::setListFromFile ( std::vector< std::string > &  filelist,
const std::string &  listFileName 
)
staticprotected

◆ setMinWindow()

void dqutils::MonitoringFile::setMinWindow ( TH1 *  h1,
float  min,
float  max 
)
static

Definition at line 3661 of file MonitoringFile_IDAlignPostProcess.cxx.

3662  {
3663  //establishes a minimum window size for TH1 histogram
3664 
3665  float min = h1->GetMinimum();
3666  float max = h1->GetMaximum();
3667  float margin = 0.05 * (max - min);
3668 
3669  if (min > windowMin) min = windowMin - margin;
3670  if (max < windowMax) max = windowMax + margin;
3671  h1->SetMinimum(min);
3672  h1->SetMaximum(max);
3673 
3674  return;
3675  }

◆ TGCChamberEfficiency()

void dqutils::MonitoringFile::TGCChamberEfficiency ( const std::string &  inFilename,
std::vector< std::pair< std::string, float > > &  p 
)
static

Definition at line 367 of file MonitoringFile_TGCPostProcess.cxx.

369  {
370  PostProcessorFileWrapper mf(inFilename, "TGC ChamberEff Calculations");
371 
372  if (!mf.IsOpen()) {
373  //std::cerr << "TGCPostProcess(): "
374  // << "Input file not opened \n";
375  return;
376  }
377  if (mf.GetSize() < 1000.) {
378  //std::cerr << "TGCPostProcess(): "
379  // << "Input file empty \n";
380  return;
381  }
382  /*
383  // get run directory name
384  //Seemingly unnecessary lines are necessary
385  TIter nextcd0(gDirectory->GetListOfKeys());
386  TKey *key0 = (TKey*)nextcd0();
387  TDirectory *dir0= dynamic_cast<TDirectory*> (key0->ReadObj());
388  dir0->cd();
390  */
391  TIter next_run(mf.GetListOfKeys());
392  TKey* key_run(0);
393  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
394  if (!key_run->IsFolder()) continue;
395  TString run_dir = key_run->GetName();
396  if (!run_dir.Contains("run")) continue;
397 
398  std::string run_dir2 = run_dir.Data();
399  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
400  //run_number=run_number;
401 
402  TString tgc_dir = run_dir + "/Muon/MuonRawDataMonitoring/TGC/";
403 
404  TString tgc_sub_dir[2] = {
405  tgc_dir + "TGCEA/", tgc_dir + "TGCEC/"
406  };
407 
408  TString sac[2] = {
409  "_A", "_C"
410  };
411  TString sws[2] = {
412  "Wire_", "Strip_"
413  };
414 
415  std::stringstream ss;
416 
417  //Summary histograms
418  TString schambertypesummary[2][3][6];//[ws][station][eta]
419  TH1F* chambertypesummary[2][3][6];//
420 
421  TString schambersummary[2][2];//[ac][ws]
422  TH1F* chambersummary[2][2];//
423 
424  std::string type[17] = {
425  "_F_T1", "_E4_T3", "_E3_T6", "_E2_T7", "_E1_T8",
426  "_F_T2", "_E5_T4", "_E4_T6", "_E3_T7", "_E2_T8", "_E1_T9",
427  "_F_T2", "_E5_T5", "_E4_T6", "_E3_T7", "_E2_T8", "_E1_T9"
428  };
429 
430  //get summary histograms
431  for (int ws = 0; ws < 2; ws++) {
432  int ntype = 0;
433  for (int station = 0; station < 3; station++) {
434  for (int eta = 0; eta < 6; eta++) {
435  if (eta == 5 && station == 0) continue;
436  if (eta < 2 && station == 3) continue;
437 
438  ss.str("");
439  ss << "Station" << station + 1 << type[ntype];
440  schambertypesummary[ws][station][eta] = tgc_dir + "Global/Summary/"
441  + "Summary_Of_" + sws[ws] + "Efficiency_Per_Chamber_Type_" +
442  ss.str();
443  if (tgc_debug) std::cout << schambertypesummary[ws][station][eta] << std::endl;
444 
445  chambertypesummary[ws][station][eta] = 0;
446  mf.get(schambertypesummary[ws][station][eta], chambertypesummary[ws][station][eta]);
447  if (!chambertypesummary[ws][station][eta]) {
448  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< schambertypesummary[ws][station][eta] <<
449  // std::endl;
450  continue;
451  }
452  TGCResetContents(chambertypesummary[ws][station][eta]);
453 
454  ntype++;
455  }//eta
456  }//station
457 
458  for (int ac = 0; ac < 2; ac++) {
459  schambersummary[ac][ws] = tgc_sub_dir[ac] + "Summary/"
460  + "Summary_Of_" + sws[ws] + "Efficiency_Per_GasGap" + sac[ac];
461  if (tgc_debug) std::cout << schambersummary[ac][ws] << std::endl;
462 
463  chambersummary[ac][ws] = 0;
464  mf.get(schambersummary[ac][ws], chambersummary[ac][ws]);
465  if (!chambersummary[ac][ws]) {
466  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< schambersummary[ac][ws] << std::endl;
467  continue;
468  }
469  TGCResetContents(chambersummary[ac][ws]);
470  }//ac
471  }//ws
472 
473  for (int ac = 0; ac < 2; ac++) {
474  for (int ws = 0; ws < 2; ws++) {
475  TString seff = tgc_sub_dir[ac] + "Efficiency/" + sws[ws] + "Efficiency_Map" + sac[ac];
476  TString sden = tgc_sub_dir[ac] + "Efficiency/NumDenom/" + sws[ws] + "Efficiency_Map" + sac[ac] +
477  "_Denominator";
478 
479  TH2F* heff = 0;
480  mf.get(seff, heff);
481  if (!heff) {
482  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< seff << std::endl;
483  continue;
484  }
485 
486  TH2F* hden = 0;
487  mf.get(sden, hden);
488  if (!hden) {
489  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< sden << std::endl;
490  }
491 
492  int nbinx = heff->GetXaxis()->GetNbins();
493  int nbiny = heff->GetYaxis()->GetNbins();
494 
495  for (int binx = 1; binx <= nbinx; binx++) {
496  for (int biny = 1; biny <= nbiny; biny++) {
497  //if( ( binx==5 || binx==10 || binx==15 ||
498  // binx==21 || binx==27 || binx==33 || binx>=39 ) &&
499  // biny%2 == 0 )continue;// skip phi1,3 for forward region
500  //if( ( binx ==40 || binx==42 ) &&
501  // ( biny ==18 || biny==34 || biny==42 ) ) continue;//skip phi9,17,21 for EI
502  if ((binx >= 33 && binx <= 43) &&
503  biny % 2 == 0) continue; // skip phi1,3 for forward region
504  if ((binx == 40 || binx == 41) &&
505  (biny == 19 || biny == 35 || biny == 43)) continue; //skip phi9,17,21 for EI
506 
507 
508  double eff = heff->GetBinContent(binx, biny);
509  double denom = 1;
510  if (hden) {
511  denom = hden->GetBinContent(binx, biny);
512  }
513 
514  if (chambersummary[ac][ws])
515  if (denom > 0) chambersummary[ac][ws]->Fill(eff);
516 
517  int station = 0;
518  int eta = -1;
519  if (binx < 16) {
520  station = 0;
521  eta = (binx - 1) % 5;
522  } else if (binx < 28) {
523  station = 1;
524  eta = (binx - 16) % 6;
525  } else if (binx < 40) {
526  station = 2;
527  eta = (binx - 28) % 6;
528  } else {
529  station = 3;
530  eta = (binx - 40) % 2;
531  }
532  if (station < 3 && eta >= 0)
533  if (chambertypesummary[ws][station][eta])
534  if (denom > 0) chambertypesummary[ws][station][eta]->Fill(eff);
535 
536  //low efficiency chambers
537  if (eff < TGCChamberEfficiencyCut) {
538  ss.str("");
539  TString schamber = heff->GetXaxis()->GetBinLabel(binx);
540  int sector = (biny - 1) / 4 + 1;
541  int phi = (biny - 1) % 4;
542  ss << sac[ac];
543  if (sector < 10) ss << "0";
544  ss << sector << "phi" << phi;
545 
546  if (tgc_debug) std::cout << "TGC low efficiency chamber : " << ss.str() << " " << eff << std::endl;
547 
548  std::pair<std::string, float> p(ss.str(), eff);
549  loweffchambers.push_back(p);
550  }
551  }//biny
552  }//binx
553 
554  TString eff_dir = tgc_sub_dir[ac] + "Efficiency/";
555  TDirectory* dir = mf.GetDirectory(eff_dir);
556 
557  if (dir) {
558  dir->cd();
559  heff->Write("", TObject::kOverwrite);
560  } else {
561  //std::cerr<<"TGCChamberEfficiency: directory "<<eff_dir<<" not found"<<std::endl;
562  }
563  }//ws
564  }//ac
565 
566  mf.Write();
567  // if directory is found, save the summary histogram
568  TString sum_dir = tgc_dir + "Global/Summary";
569  TDirectory* dir = mf.GetDirectory(sum_dir);
570 
571 
572  if (dir) {
573  dir->cd();
574  for (int ws = 0; ws < 2; ws++) {
575  for (int station = 0; station < 3; station++) {
576  for (int eta = 0; eta < 6; eta++) {
577  if (eta == 5 && station == 0) continue;
578  if (eta < 2 && station == 3) continue;
579  if (chambertypesummary[ws][station][eta]) chambertypesummary[ws][station][eta]->Write("",
580  TObject::kOverwrite);
581 
582  }//eta
583  }//station
584  }//ws
585  } else {
586  //std::cerr<<"TGCChamberEfficiency: directory "<<sum_dir<<" not found"<<std::endl;
587  }//if
588  mf.Write();
589 
590  for (int ac = 0; ac < 2; ac++) {
591  // if directory is found, save the summary histogram
592  sum_dir = tgc_sub_dir[ac] + "Summary/";
593  dir = mf.GetDirectory(sum_dir);
594  if (dir) {
595  dir->cd();
596  for (int ws = 0; ws < 2; ws++) {
597  if (chambersummary[ac][ws]) chambersummary[ac][ws]->Write("", TObject::kOverwrite);
598  }//ws
599  } else {
600  //std::cerr<<"TGCChamberEfficiency: directory "<<sum_dir<<" not found"<<std::endl;
601  }//if
602  }//ac
603  mf.Write();
604  }//while
605  mf.Write();
606  }//MonitoringFile::TGCChamberEfficiency

◆ TGCChamberOccupancy()

void dqutils::MonitoringFile::TGCChamberOccupancy ( const std::string &  inFilename,
std::vector< std::pair< std::string, float > > &  phigh,
std::vector< std::pair< std::string, float > > &  plow 
)
static

Definition at line 82 of file MonitoringFile_TGCPostProcess.cxx.

84  {
85  PostProcessorFileWrapper mf(inFilename, "TGC ChamberOcc Calculations");
86 
87  if (!mf.IsOpen()) {
88  //std::cerr << "TGCPostProcess(): "
89  // << "Input file not opened \n";
90  return;
91  }
92  if (mf.GetSize() < 1000.) {
93  //std::cerr << "TGCPostProcess(): "
94  // << "Input file empty \n";
95  return;
96  }
97  /*
98  // get run directory name
99  //Seemingly unnecessary lines are necessary
100  TIter nextcd0(gDirectory->GetListOfKeys());
101  TKey *key0 = (TKey*)nextcd0();
102  TDirectory *dir0= dynamic_cast<TDirectory*> (key0->ReadObj());
103  dir0->cd();
105  */
106  TIter next_run(mf.GetListOfKeys());
107  TKey* key_run(0);
108  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
109  if (!key_run->IsFolder()) continue;
110  TString run_dir = key_run->GetName();
111  if (!run_dir.Contains("run")) continue;
112 
113  std::string run_dir2 = run_dir.Data();
114  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
115  //run_number=run_number;
116 
117  TString tgc_dir = run_dir + "/Muon/MuonRawDataMonitoring/TGC/";
118 
119  TString tgc_global_dir = tgc_dir + "Global/";
120 
121  TString tgc_sub_dir[2] = {
122  tgc_dir + "TGCEA/", tgc_dir + "TGCEC/"
123  };
124 
125  TString sac[2] = {
126  "_A", "_C"
127  };
128  TString side[2] = {
129  "A", "C"
130  };
131  TString sws[2] = {
132  "Wire_", "Strip_"
133  };
134 
135  std::stringstream ss;
136 
137  //Summary histograms
138  TString schambertypesummary[2][4][6];//[ws][station][eta]
139  TH1F* chambertypesummary[2][4][6];//
140 
141  TString schambersummary[2][2];//[ac][ws]
142  TH1F* chambersummary[2][2];//
143 
144  std::string type[17] = {
145  "_F_T1", "_E4_T3", "_E3_T6", "_E2_T7", "_E1_T8",
146  "_F_T2", "_E5_T4", "_E4_T6", "_E3_T7", "_E2_T8", "_E1_T9",
147  "_F_T2", "_E5_T5", "_E4_T6", "_E3_T7", "_E2_T8", "_E1_T9"
148  };
149 
150  //get summary histograms
151  for (int ws = 0; ws < 2; ws++) {
152  int ntype = 0;
153  for (int station = 0; station < 3; station++) {
154  for (int eta = 0; eta < 6; eta++) {
155  if (eta == 5 && station == 0) continue;
156  if (eta < 2 && station == 3) continue;
157 
158  ss.str("");
159  ss << "Station" << station + 1 << type[ntype];
160  schambertypesummary[ws][station][eta] = tgc_dir + "Global/Summary/"
161  + "Summary_Of_Log10_" + sws[ws] + "Occupancy_Per_Chamber_Type_" +
162  ss.str();
163  if (tgc_debug) std::cout << schambertypesummary[ws][station][eta] << std::endl;
164 
165  chambertypesummary[ws][station][eta] = 0;
166  mf.get(schambertypesummary[ws][station][eta], chambertypesummary[ws][station][eta]);
167  if (!chambertypesummary[ws][station][eta]) {
168  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< schambertypesummary[ws][station][eta] <<
169  // std::endl;
170  continue;
171  }
172  TGCResetContents(chambertypesummary[ws][station][eta]);
173 
174  ntype++;
175  }//eta
176  }//station
177 
178  for (int ac = 0; ac < 2; ac++) {
179  schambersummary[ac][ws] = tgc_sub_dir[ac] + "Summary/"
180  + "Summary_Of_Log10_" + sws[ws] + "Occupancy_Per_GasGap" + sac[ac];
181  if (tgc_debug) std::cout << schambersummary[ac][ws] << std::endl;
182 
183  chambersummary[ac][ws] = 0;
184  mf.get(schambersummary[ac][ws], chambersummary[ac][ws]);
185  if (!chambersummary[ac][ws]) {
186  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< schambersummary[ac][ws] << std::endl;
187  continue;
188  }
189  TGCResetContents(chambersummary[ac][ws]);
190  }// ac
191  }// ws
192 
193  //get number of events processed
194  TString sentries = tgc_global_dir + "Event_Counter";
195 
196  TH1F* hentries = 0;
197  mf.get(sentries, hentries);
198  if (!hentries) {
199  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< sentries << std::endl;
200  continue;
201  }
202 
203  double nentries = hentries->GetEntries();
204 
205  //calculate occupancies
206  for (int ac = 0; ac < 2; ac++) {
207  for (int ws = 0; ws < 2; ws++) {
208  double min = 1.;
209  double max = 0.;
210 
211  TString sprof = tgc_sub_dir[ac] + "Profile/" + sws[ws] + "Profile_Map" + sac[ac];
212  TString soccu = tgc_sub_dir[ac] + "Occupancy/" + sws[ws] + "Occupancy_Map" + sac[ac];
213 
214  TH2F* hprof = 0;
215  mf.get(sprof, hprof);
216  if (!hprof) {
217  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< sprof << std::endl;
218  continue;
219  }
220 
221  TH2F* hoccu = 0;
222  mf.get(soccu, hoccu);
223  if (!hoccu) {
224  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< soccu << std::endl;
225  continue;
226  }
227  TGCResetContents(hoccu);
228 
229  int nbinx = hprof->GetXaxis()->GetNbins();
230  int nbiny = hprof->GetYaxis()->GetNbins();
231 
232  for (int binx = 1; binx <= nbinx; binx++) {
233  for (int biny = 1; biny <= nbiny; biny++) {
234  if (ws == 1 && (binx == 2 || binx == 9 || binx == 16 || binx == 23 || binx == 34)) continue; //skip strip
235  // for layer2
236  if ((binx >= 33 && binx <= 43) &&
237  biny % 2 == 0) continue; // skip phi1,3 for forward region
238  if ((binx == 40 || binx == 41) &&
239  (biny == 19 || biny == 35 || biny == 43)) continue; //skip phi9,17,21 for EI
240 
241  double num = hprof->GetBinContent(binx, biny);
242  double den = nentries * nTGCWireStripMap(ws, binx - 1, biny);
243  double occu = 0.;
244  double eoccu = 0.;
245  if (num > 0 && nentries > 0) {
246  occu = (double) num / den;
247  eoccu = sqrt(occu * (1. - occu) / den);
248  }
249  hoccu->SetBinContent(binx, biny, occu);
250  hoccu->SetBinError(binx, biny, eoccu);
251 
252  // to set minimum and maximum
253  if (occu < min && occu > 1e-8) min = occu;
254  if (occu > max) max = occu;
255 
256  if (occu < 1.e-8) {
257  occu = 1.e-8;
258  eoccu = 1.e-8;
259  }
260  if (chambersummary[ac][ws]) chambersummary[ac][ws]->Fill(log10(occu));
261 
262  int station = 0;
263  int eta = -1;
264  if (binx < 16) {
265  station = 0;
266  eta = (binx - 1) % 5;
267  } else if (binx < 28) {
268  station = 1;
269  eta = (binx - 16) % 6;
270  } else if (binx < 40) {
271  station = 2;
272  eta = (binx - 28) % 6;
273  } else {
274  station = 3;
275  eta = (binx - 40) % 2;
276  }
277  if (station < 3 && eta >= 0)
278  if (chambertypesummary[ws][station][eta]) chambertypesummary[ws][station][eta]->Fill(log10(occu));
279 
280  //high occupancy chamber
281  if (occu > TGCChamberHighOccupancyCut) {
282  ss.str("");
283  TString schamber = hprof->GetXaxis()->GetBinLabel(binx);
284  int sector = (biny - 1) / 4 + 1;
285  int phi = (biny - 1) % 4;
286  ss << side[ac];
287  if (sector < 10) ss << "0";
288  ss << sector << "phi" << phi;
289  if (tgc_debug) std::cout << "TGC noisy channel : " << ss.str() << " " << occu << std::endl;
290 
291  std::pair<std::string, float> p(ss.str(), occu);
292  noisychambers.push_back(p);
293  } else if (occu < TGCChamberLowOccupancyCut) {//too low occupancy
294  ss.str("");
295  TString schamber = hprof->GetXaxis()->GetBinLabel(binx);
296  int sector = (biny - 1) / 4 + 1;
297  int phi = (biny - 1) % 4;
298  ss << side[ac];
299  if (sector < 10) ss << "0";
300  ss << sector << "phi" << phi;
301  if (tgc_debug) std::cout << "TGC low occupancy chamber : " << ss.str() << " " << occu << std::endl;
302 
303  std::pair<std::string, float> p(ss.str(), occu);
304  deadchambers.push_back(p);
305  }
306  }//biny
307  }//binx
308 
309  hoccu->SetMinimum(min * 0.95);
310  hoccu->SetMaximum(max * 1.05);
311 
312  TString occu_dir = tgc_sub_dir[ac] + "Occupancy/";
313  TDirectory* dir = mf.GetDirectory(occu_dir);
314 
315  if (dir) {
316  dir->cd();
317  hoccu->Write("", TObject::kOverwrite);
318  } else {
319  //std::cerr<<"TGCChamberOccupancy: directory "<<occu_dir<<" not found"<<std::endl;
320  }
321  }//ws
322  }//ac
323  mf.Write();
324 
325  // if directory is found, save the summary histogram
326  TString sum_dir = tgc_dir + "Global/Summary";
327  TDirectory* dir = mf.GetDirectory(sum_dir);
328 
329  if (dir) {
330  dir->cd();
331  for (int ws = 0; ws < 2; ws++) {
332  for (int station = 0; station < 3; station++) {
333  for (int eta = 0; eta < 6; eta++) {
334  if (eta == 5 && station == 0) continue;
335  if (eta < 2 && station == 3) continue;
336  if (chambertypesummary[ws][station][eta]) chambertypesummary[ws][station][eta]->Write("",
337  TObject::kOverwrite);
338 
339  }//eta
340  }//station
341  }//ws
342  } else {
343  //std::cerr<<"TGCChamberOccupancy: directory "<<sum_dir<<" not found"<<std::endl;
344  }//if
345  mf.Write();
346 
347  for (int ac = 0; ac < 2; ac++) {
348  // if directory is found, save the summary histogram
349  sum_dir = tgc_sub_dir[ac] + "Summary/";
350  dir = mf.GetDirectory(sum_dir);
351  if (dir) {
352  dir->cd();
353  for (int ws = 0; ws < 2; ws++) {
354  if (chambersummary[ac][ws]) chambersummary[ac][ws]->Write("", TObject::kOverwrite);
355  }//ws
356  } else {
357  //std::cerr<<"TGCChamberOccupancy: directory "<<sum_dir<<" not found"<<std::endl;
358  }//if
359  }//ac
360  mf.Write();
361  }//while
362 
363  mf.Write();
364  }//MonitoringFile::TGCChamberOccupancy

◆ TGCChamberTiming()

void dqutils::MonitoringFile::TGCChamberTiming ( const std::string &  inFilename,
std::vector< std::pair< std::string, float > > &  pro,
std::vector< std::pair< std::string, float > > &  ptrg 
)
static

Definition at line 609 of file MonitoringFile_TGCPostProcess.cxx.

611  {
612  PostProcessorFileWrapper mf(inFilename, "TGC Chamber Timing Calculations");
613 
614  if (!mf.IsOpen()) {
615  //std::cerr << "TGCPostProcess(): "
616  // << "Input file not opened \n";
617  return;
618  }
619  if (mf.GetSize() < 1000.) {
620  //std::cerr << "TGCPostProcess(): "
621  // << "Input file empty \n";
622  return;
623  }
624  /*
625  // get run directory name
626  //Seemingly unnecessary lines are necessary
627  TIter nextcd0(gDirectory->GetListOfKeys());
628  TKey *key0 = (TKey*)nextcd0();
629  TDirectory *dir0= dynamic_cast<TDirectory*> (key0->ReadObj());
630  dir0->cd();
632  */
633  TIter next_run(mf.GetListOfKeys());
634  TKey* key_run(0);
635  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
636  if (!key_run->IsFolder()) continue;
637  TString run_dir = key_run->GetName();
638  if (!run_dir.Contains("run")) continue;
639 
640  std::string run_dir2 = run_dir.Data();
641  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
642  //run_number=run_number;
643 
644  TString tgc_dir = run_dir + "/Muon/MuonRawDataMonitoring/TGCLV1/";
645 
646  TString tgc_sub_dir[2] = {
647  tgc_dir + "TGCEA/", tgc_dir + "TGCEC/"
648  };
649 
650  TString sac[2] = {
651  "_A", "_C"
652  };
653 
654  TString ssllpt[2] = {
655  "SL_Timing", "Low_Pt_Timing"
656  };
657 
658  std::stringstream ss;
659  //Summary histograms
660  TString schambertypesummary[6];//[station][eta]
661  TH1F* chambertypesummary[6];//
662 
663  std::string type[6] = {
664  "_F_T2", "_E5_T5", "_E4_T6", "_E3_T7", "_E2_T8", "_E1_T9"
665  };
666 
667  for (int sllpt = 0; sllpt < 2; sllpt++) {//loop over SL/LPT
668  for (int eta = 0; eta < 6; eta++) {
669  //get summary histograms
670  ss.str("");
671  ss << type[eta];
672  schambertypesummary[eta] = tgc_dir + "Global/Summary/"
673  + "Summary_Of_" + ssllpt[sllpt] + "_Per_Chamber_Type" + ss.str();
674 
675  chambertypesummary[eta] = 0;
676  mf.get(schambertypesummary[eta], chambertypesummary[eta]);
677  if (!chambertypesummary[eta]) {
678  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< schambertypesummary[eta] << std::endl;
679  continue;
680  }
681  TGCResetContents(chambertypesummary[eta]);
682  }//eta
683 
684  for (int ac = 0; ac < 2; ac++) {
685  //get summary histogram
686  TString ssum = tgc_sub_dir[ac] + "Summary/Summary_Of_" + ssllpt[sllpt] + sac[ac];
687  TString stmap = tgc_sub_dir[ac] + ssllpt[sllpt] + "_Map" + sac[ac];
688  TString stfrac = tgc_sub_dir[ac] + ssllpt[sllpt] + "_Fraction_Map" + sac[ac];
689 
690  TH1F* hsum = 0;
691  mf.get(ssum, hsum);
692  if (!hsum) {
693  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< ssum << std::endl;
694  continue;
695  }
696 
697  TH2F* htmap = 0;
698  mf.get(stmap, htmap);
699  if (!htmap) {
700  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< stmap << std::endl;
701  continue;
702  }
703 
704  TH2F* htfrac = 0;
705  mf.get(stfrac, htfrac);
706  if (!htfrac) {
707  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< stfrac << std::endl;
708  continue;
709  }
710 
712  TGCResetContents(htfrac);
713 
714  int nbinx = htmap->GetXaxis()->GetNbins();
715  int nbiny = htmap->GetYaxis()->GetNbins();
716 
717  if (nbinx != 18 || nbiny != 48) continue;
718 
719  for (int eta = 0; eta < 6; eta++) {
720  for (int phi48 = 0; phi48 < 48; phi48++) {
721  if (eta == 5 && phi48 % 2 == 1) continue; //Forward
722 
723  float p = htmap->GetBinContent(eta + 1, phi48 + 1);
724  float c = htmap->GetBinContent(eta + 7, phi48 + 1);
725  float n = htmap->GetBinContent(eta + 13, phi48 + 1);
726  float tot = p + n + c;
727 
728  float fp = 0;
729  float fc = 0;
730  float fn = 0;
731 
732  float efp = 0;
733  float efc = 0;
734  float efn = 0;
735 
736  if (tot != 0) {
737  fp = p / tot;
738  efp = sqrt(fp * (1. - fp) / tot);
739  fc = c / tot;
740  efc = sqrt(fc * (1. - fc) / tot);
741  fn = n / tot;
742  efn = sqrt(fn * (1. - fn) / tot);
743  }
744 
745  htfrac->SetBinContent(eta + 1, phi48 + 1, fp);
746  htfrac->SetBinContent(eta + 7, phi48 + 1, fc);
747  htfrac->SetBinContent(eta + 13, phi48 + 1, fn);
748  htfrac->SetBinError(eta + 1, phi48 + 1, efp);
749  htfrac->SetBinError(eta + 7, phi48 + 1, efc);
750  htfrac->SetBinError(eta + 13, phi48 + 1, efn);
751 
752  if (chambertypesummary[eta]) chambertypesummary[eta]->Fill(fc);
753  hsum->Fill(fc);
754 
755  //low current fraction chambers
756  if (fc < TGCChamberTimingCut) {
757  ss.str("");
758  //std::string chamber = htiming->GetXaxis()->GetBinLabel(bin);
759  ss << sac[ac] << "phi" << phi48 + 1 << "Eta" << eta;
760 
761  if (tgc_debug) std::cout << "TGC " << ssllpt[sllpt] << " low current BCID fraction chamber : " <<
762  ss.str() << " " << fc << std::endl;
763 
764  std::pair<std::string, float> p(ss.str(), fc);
765  if (sllpt == 0) {
766  badtrgtimingchambers.push_back(p);
767  } else {
768  badrotimingchambers.push_back(p);
769  }
770  }
771  }//phi48
772  }//eta
773 
774  //write timing fraction
775  TString timing_dir = tgc_sub_dir[ac];
776  TDirectory* dir = mf.GetDirectory(timing_dir);
777 
778  if (dir) {
779  dir->cd();
780  htfrac->Write("", TObject::kOverwrite);
781  } else {
782  //std::cerr<<"TGCChamberTiming : directory "<<timing_dir<<" not found"<<std::endl;
783  }
784 
785  //write summary of timing for each side
786  TString sum_dir = tgc_sub_dir[ac] + "Summary/";
787  dir = mf.GetDirectory(sum_dir);
788 
789  if (dir) {
790  dir->cd();
791  hsum->Write("", TObject::kOverwrite);
792  } else {
793  //std::cerr<<"TGCChamberTiming : directory "<<sum_dir<<" not found"<<std::endl;
794  }
795  }//ac
796  mf.Write();
797 
798  //write summary of timing for each eta
799  TString sum_dir = tgc_dir + "Global/Summary/";
800  TDirectory* dir = mf.GetDirectory(sum_dir);
801 
802  if (dir) {
803  dir->cd();
804  for (int eta = 0; eta < 6; eta++) {
805  if (chambertypesummary[eta]) chambertypesummary[eta]->Write("", TObject::kOverwrite);
806  }
807  } else {
808  //std::cerr<<"TGCChamberTiming : directory "<<sum_dir<<" not found"<<std::endl;
809  }
810  mf.Write();
811  }//sllpt
812  }//while
813  mf.Write();
814  }//MonitoringFile::TGCChamberTiming

◆ TGCChannelOccupancy()

void dqutils::MonitoringFile::TGCChannelOccupancy ( const std::string &  inFilename,
std::vector< std::pair< std::string, float > > &  p 
)
static

Definition at line 817 of file MonitoringFile_TGCPostProcess.cxx.

819  {
820  PostProcessorFileWrapper mf(inFilename, "TGC ChannelOcc Calculations");
821 
822  if (!mf.IsOpen()) {
823  //std::cerr << "TGCPostProcess(): "
824  // << "Input file not opened \n";
825  return;
826  }
827  if (mf.GetSize() < 1000.) {
828  //std::cerr << "TGCPostProcess(): "
829  // << "Input file empty \n";
830  return;
831  }
832  /*
833  // get run directory name
834  //Seemingly unnecessary lines are necessary
835  TIter nextcd0(gDirectory->GetListOfKeys());
836  TKey *key0 = (TKey*)nextcd0();
837  TDirectory *dir0= dynamic_cast<TDirectory*> (key0->ReadObj());
838  dir0->cd();
840  */
841  TIter next_run(mf.GetListOfKeys());
842  TKey* key_run(0);
843  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
844  if (!key_run->IsFolder()) continue;
845  TString run_dir = key_run->GetName();
846  if (!run_dir.Contains("run")) continue;
847 
848  std::string run_dir2 = run_dir.Data();
849  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
850  //run_number=run_number;
851 
852  TString tgc_dir = run_dir + "/Muon/MuonRawDataMonitoring/TGC/";
853 
854  TString tgc_global_dir = tgc_dir + "Global/";
855  TString tgc_sub_dir[2] = {
856  tgc_dir + "TGCEA/", tgc_dir + "TGCEC/"
857  };
858 
859  TString sac[2] = {
860  "_A", "_C"
861  };
862  TString sws[2] = {
863  "Wire_", "Strip_"
864  };
865  TString slay[7] = {
866  "1", "2", "3", "4", "5", "6", "7"
867  };
868  std::stringstream ss;
869 
870  //get number of events processed
871  TString sentries = tgc_global_dir + "Event_Counter";
872 
873  TH1F* hentries = 0;
874  mf.get(sentries, hentries);
875  if (!hentries) {
876  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< sentries << std::endl;
877  continue;
878  }
879 
880  double nentries = hentries->GetEntries();
881 
882  for (int ac = 0; ac < 2; ac++) {
883  for (int ws = 0; ws < 2; ws++) {
884  for (int lay = 0; lay < 7; lay++) {
885  if (ws == 1 && lay == 1) continue;
886  for (int subsect = 1; subsect <= 48; subsect++) {
887  //get each subsector histogram
888  int sector, phi4;
889  TGCsubsect2sectorphi(subsect, sector, phi4);
890 
891  ss.str("");
892  if (sector < 10) ss << "0";
893  ss << sector << "_Layer" << slay[lay] << "_Phi" << phi4;
894  TString sprof = tgc_sub_dir[ac] + "Profile/" + sws[ws] + "Hit_Profile" + sac[ac] + ss.str();
895 
896  TH1F* hprof = 0;
897  mf.get(sprof, hprof);
898  if (!hprof) {
899  //std::cerr <<"TGC PostProcessing: no such histogram!! "<< sprof << std::endl;
900  continue;
901  }
902 
903  int nbin = hprof->GetXaxis()->GetNbins();
904 
905  for (int bin = 1; bin <= nbin; bin++) {
906  double num = hprof->GetBinContent(bin);
907  float occu = 0.;
908  if (nentries > 0) occu = (float) num / nentries;
909  if (occu > TGCChannelOccupancyCut) {
910  ss.str("");
911  ss << hprof->GetName() << " " << bin;
912  if (tgc_debug) std::cout << "TGC noisy channel : " << ss.str() << " " << occu << std::endl;
913 
914  std::pair<std::string, float> p(ss.str(), occu);
915  noisychannels.push_back(p);
916  }
917  }//bin
918  }//subsect
919  }//lay
920  }//loop over ws
921  }//loop over ac
922  }//while
923  }//MonitoringFile::TGCChannelOccupancy

◆ TGCCheckHistogram()

bool dqutils::MonitoringFile::TGCCheckHistogram ( TFile *  f,
TString &  hname 
)
static

Definition at line 71 of file MonitoringFile_TGCPostProcess.cxx.

71  {
72  if (!(f->Get(hname))) {
73  //std::cerr << "TGC PostProcessing: no such histogram!! : "<< hname << std::endl;
74  gDirectory->pwd();
75  gDirectory->ls();
76  return false;
77  }
78  return true;
79  }//MonitoringFile::TGCCheckHistogram

◆ TGCLV1HistogramDivision()

void dqutils::MonitoringFile::TGCLV1HistogramDivision ( const std::string &  inFilename)
static

Definition at line 202 of file MonitoringFile_TgcHistogramDivision.cxx.

202  {
203  PostProcessorFileWrapper mf(inFilename, "TGC LV1 Histogram Division");
204 
205  if (!mf.IsOpen()) {
206  //std::cerr << "TGCPostProcess(): "
207  // << "Input file not opened \n";
208  return;
209  }
210  if (mf.GetSize() < 1000.) {
211  //std::cerr << "TGCPostProcess(): "
212  // << "Input file empty \n";
213  return;
214  }
215  /*
216  // get run directory name
217  //Seemingly unnecessary lines are necessary
218  TIter nextcd0(gDirectory->GetListOfKeys());
219  TKey *key0 = (TKey*)nextcd0();
220  TDirectory *dir0= dynamic_cast<TDirectory*> (key0->ReadObj());
221  dir0->cd();
223  */
224  std::stringstream ss;
225  TString sac[2] = {
226  "_A", "_C"
227  };
228  //TString sws[2]={"Wire_","Strip_"};
229 
230  TIter next_run(mf.GetListOfKeys());
231  TKey* key_run(0);
232  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
233  if (!key_run->IsFolder()) continue;
234  TString run_dir = key_run->GetName();
235  if (!run_dir.Contains("run")) continue;
236 
237  std::string run_dir2 = run_dir.Data();
238  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
239 
240  TString seff;
241  TString snum;
242  TString sden;
243  TString seffg;
244 
245  TH1F* h1eff(0);
246  TH1F* h1num(0);
247  TH1F* h1den(0);
248  TH2F* h2eff(0);
249  TH2F* h2num(0);
250  TH2F* h2den(0);
251  TGraphAsymmErrors* geff(0);
252 
253  //===TGCLV1
254  TString tgc_dir = run_dir + "/Muon/MuonRawDataMonitoring/TGCLV1/";
255 
256  TString tgc_global_dir = tgc_dir + "Global/";
257  TString tgc_sub_dir[2] = {
258  tgc_dir + "TGCEA/", tgc_dir + "TGCEC/"
259  };
260 
261  std::string smuid[2] = {
262  "_Muid", "_Staco"
263  };
264  std::string spna[3] = {
265  "_Posi", "_Nega", ""
266  };
267 
268  std::string sbc[3] = {
269  "_Previous", "", "_Next"
270  };
271 
272  for (int ac = 0; ac < 2; ac++) {
273  TString eff_dir = tgc_sub_dir[ac] + "Eff/";
274  TDirectory* dir = mf.GetDirectory(eff_dir);
275  if (!dir) {
276  //std::cerr<< "TGCHistogramDivision: directory "<<eff_dir<<" not found"<<std::endl;
277  return;
278  }
279 
280  for (int pt = 1; pt <= 6; pt++) {
281  for (int pna = 0; pna < 3; pna++) {
282  for (int muid = 0; muid < 2; muid++) {
283  for (int pcn = 0; pcn < 3; pcn++) {
284  std::string tempeff, tempnum, tempden;
285  //Efficiency
286  ss.str("");
287  ss << "Trigger_Efficiency" << spna[pna] << sbc[pcn] << "_PT" << pt << smuid[muid] << sac[ac];
288  seff = eff_dir + ss.str();
289  tempeff = ss.str();
290  ss.str("");
291  ss << "Trigger_Efficiency" << spna[pna] << sbc[pcn] << "_PT" << pt << smuid[muid] << sac[ac] <<
292  "_Numerator";
293  snum = eff_dir + "NumDenom/" + ss.str();
294  tempnum = ss.str();
295  ss.str("");
296  ss << "Trigger_Efficiency" << spna[pna] << "_PT" << pt << smuid[muid] << sac[ac] << "_Denominator";
297  sden = eff_dir + "NumDenom/" + ss.str();
298  tempden = ss.str();
299 
300  h2eff = 0;
301  mf.get(seff, h2eff);
302  h2num = 0;
303  mf.get(snum, h2num);
304  h2den = 0;
305  mf.get(sden, h2den);
306  if (h2eff && h2num && h2den) {
307  TGCResetContents(h2eff);
308  h2eff->Divide(h2num, h2den, 1., 1., "B");
309 
310  // save the summary histogram
311  dir = mf.GetDirectory(eff_dir);
312  dir->cd();
313  h2eff->Write("", TObject::kOverwrite);
314  } else {
315  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
316  continue;
317  }
318  mf.Write();
319  }//pcn
320 
321  //Turn on
322  ss.str("");
323  ss << "Trigger_Turn_On_Curve" << spna[pna] << "_PT" << pt << smuid[muid] << sac[ac];
324  seff = eff_dir + ss.str();
325  ss << "_Fit";
326  seffg = eff_dir + ss.str();
327  ss.str("");
328  ss << "Trigger_Turn_On_Curve" << spna[pna] << "_PT" << pt << smuid[muid] << sac[ac] << "_Numerator";
329  snum = eff_dir + "NumDenom/" + ss.str();
330  ss.str("");
331  ss << "Trigger_Turn_On_Curve" << spna[pna] << "_PT" << pt << smuid[muid] << sac[ac] << "_Denominator";
332  sden = eff_dir + "NumDenom/" + ss.str();
333 
334  h1eff = 0;
335  mf.get(seff, h1eff);
336  h1num = 0;
337  mf.get(snum, h1num);
338  h1den = 0;
339  mf.get(sden, h1den);
340  geff = 0;
341  mf.get(seffg, geff);
342 
343  if (h1eff && h1num && h1den) {
344  TGCResetContents(h1eff);
345  h1eff->Divide(h1num, h1den, 1., 1., "B");
346 
347  // save the summary histogram
348  dir = mf.GetDirectory(eff_dir);
349  dir->cd();
350  h1eff->Write("", TObject::kOverwrite);
351 
352  if (geff) {
353  geff->BayesDivide(h1num, h1den);
354 
355  // save the summary histogram
356  dir = mf.GetDirectory(eff_dir);
357  dir->cd();
358  geff->Write("", TObject::kOverwrite);
359  }
360  } else {
361  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
362  continue;
363  }
364  mf.Write();
365  }//muid
366  }//pna
367  mf.Write();
368 
369  //Rate Ratio
370  TString grate_dir = tgc_global_dir + "Rate/";
371  TString rate_dir = tgc_sub_dir[ac] + "Rate/";
372  TString rr_dir = tgc_sub_dir[ac] + "Rate/Ratio/";
373  dir = mf.GetDirectory(rr_dir);
374  if (!dir) {
375  //std::cerr<< "TGCHistogramDivision: directory "<<rr_dir<<" not found"<<std::endl;
376  return;
377  }
378 
379  // trigger/10BCID
380  ss.str("");
381  ss << "Number_Of_PT" << pt << "_Triggers_Per_Event_Vs_10BCID" << sac[ac];
382  seff = rr_dir + ss.str();
383  ss.str("");
384  ss << "Number_Of_PT" << pt << "_Triggers_In_10BCID" << sac[ac];
385  snum = rate_dir + ss.str();
386  ss.str("");
387  ss << "Number_Of_Events_In_10BCID";
388  sden = grate_dir + ss.str();
389 
390  h1eff = 0;
391  mf.get(seff, h1eff);
392  h1num = 0;
393  mf.get(snum, h1num);
394  h1den = 0;
395  mf.get(sden, h1den);
396 
397  if (h1eff && h1num && h1den) {
398  TGCResetContents(h1eff);
399  h1eff->Divide(h1num, h1den);
400 
401  // save the summary histogram
402  dir->cd();
403  h1eff->Write("", TObject::kOverwrite);
404  } else {
405  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
406  continue;
407  }
408 
409  //trigger/2LB
410  ss.str("");
411  ss << "Number_Of_PT" << pt << "_Triggers_Per_Event_Vs_2LB" << sac[ac];
412  seff = rr_dir + ss.str();
413  ss.str("");
414  ss << "Number_Of_PT" << pt << "_Triggers_In_2LB" << sac[ac];
415  snum = rate_dir + ss.str();
416  ss.str("");
417  ss << "Number_Of_Events_In_2LB";
418  sden = grate_dir + ss.str();
419 
420  h1eff = 0;
421  mf.get(seff, h1eff);
422  h1num = 0;
423  mf.get(snum, h1num);
424  h1den = 0;
425  mf.get(sden, h1den);
426 
427  if (h1eff && h1num && h1den) {
428  TGCResetContents(h1eff);
429  h1eff->Divide(h1num, h1den);
430 
431  // save the summary histogram
432  dir->cd();
433  h1eff->Write("", TObject::kOverwrite);
434  } else {
435  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
436  continue;
437  }
438  mf.Write();
439  }//pt
440 
441  //Rate Ratio
442  TString grate_dir = tgc_global_dir + "Rate/";
443  TString rate_dir = tgc_sub_dir[ac] + "Rate/";
444  TString rr_dir = tgc_sub_dir[ac] + "Rate/Ratio/";
445 
446  // trigger/10BCID
447  ss.str("");
448  ss << "Number_Of_SL_Triggers_Per_Event_Vs_10BCID" << sac[ac];
449  seff = rr_dir + ss.str();
450  ss.str("");
451  ss << "Number_Of_SL_Triggers_In_10BCID" << sac[ac];
452  snum = rate_dir + ss.str();
453  ss.str("");
454  ss << "Number_Of_Events_In_10BCID";
455  sden = grate_dir + ss.str();
456 
457  h1eff = 0;
458  mf.get(seff, h1eff);
459  h1num = 0;
460  mf.get(snum, h1num);
461  h1den = 0;
462  mf.get(sden, h1den);
463 
464  if (h1eff && h1num && h1den) {
465  TGCResetContents(h1eff);
466  h1eff->Divide(h1num, h1den);
467 
468  // save the summary histogram
469  dir = mf.GetDirectory(rr_dir);
470  dir->cd();
471  h1eff->Write("", TObject::kOverwrite);
472  } else {
473  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
474  continue;
475  }
476 
477  //trigger/2LB
478  ss.str("");
479  ss << "Number_Of_SL_Triggers_Per_Event_Vs_2LB" << sac[ac];
480  seff = rr_dir + ss.str();
481  ss.str("");
482  ss << "Number_Of_SL_Triggers_In_2LB" << sac[ac];
483  snum = rate_dir + ss.str();
484  ss.str("");
485  ss << "Number_Of_Events_In_2LB";
486  sden = grate_dir + ss.str();
487 
488  h1eff = 0;
489  mf.get(seff, h1eff);
490  h1num = 0;
491  mf.get(snum, h1num);
492  h1den = 0;
493  mf.get(sden, h1den);
494 
495  if (h1eff && h1num && h1den) {
496  TGCResetContents(h1eff);
497  h1eff->Divide(h1num, h1den);
498 
499  // save the summary histogram
500  dir->cd();
501  h1eff->Write("", TObject::kOverwrite);
502  } else {
503  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
504  continue;
505  }
506  mf.Write();
507  }//ac
508  //====End TGCLV1
509  }
510 
511  mf.Write();
512  }

◆ TGCPostProcess()

void dqutils::MonitoringFile::TGCPostProcess ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

Definition at line 46 of file MonitoringFile_TGCPostProcess.cxx.

46  {
47  //start postprocessing
48  std::vector< std::pair< std::string, float > > NoisyChambers;
49  std::vector< std::pair< std::string, float > > DeadChambers;
50 
51  std::vector< std::pair< std::string, float > > NoisyChannels;
52 
53  std::vector< std::pair< std::string, float > > LowEfficiencyChambers;
54 
55  std::vector< std::pair< std::string, float > > ReadoutTimingChambers;
56  std::vector< std::pair< std::string, float > > TriggerTimingChambers;
57 
58  TGCLV1HistogramDivision(inFilename);
59  TGCRawHistogramDivision(inFilename);
60  TGCChamberOccupancy(inFilename, NoisyChambers, DeadChambers);
61  // TGCChannelOccupancy( inFilename, run_dir, NoisyChannels );
62 
63  TGCChamberEfficiency(inFilename, LowEfficiencyChambers);
64  TGCChamberTiming(inFilename, ReadoutTimingChambers, TriggerTimingChambers);
65  //DQA results to COOL
66 
67  return;
68  }//MonitoringFile::TGCPostProcess

◆ TGCRawHistogramDivision()

void dqutils::MonitoringFile::TGCRawHistogramDivision ( const std::string &  inFilename)
static

Definition at line 39 of file MonitoringFile_TgcHistogramDivision.cxx.

39  {
40  PostProcessorFileWrapper mf(inFilename, "TGC Raw Histogram Division");
41 
42  if (!mf.IsOpen()) {
43  //std::cerr << "TGCPostProcess(): "
44  // << "Input file not opened \n";
45  return;
46  }
47  if (mf.GetSize() < 1000.) {
48  //std::cerr << "TGCPostProcess(): "
49  // << "Input file empty \n";
50  return;
51  }
52 
53  std::stringstream ss;
54  TString sac[2] = {
55  "_A", "_C"
56  };
57  TString sws[2] = {
58  "Wire_", "Strip_"
59  };
60 
61  TIter next_run(mf.GetListOfKeys());
62  TKey* key_run(0);
63 
64  while ((key_run = dynamic_cast<TKey*> (next_run())) != 0) {
65  if (!key_run->IsFolder()) continue;
66  TString run_dir = key_run->GetName();
67  if (!run_dir.Contains("run")) continue;
68 
69  std::string run_dir2 = run_dir.Data();
70  //int run_number = atoi( (run_dir2.substr(4, run_dir2.size()-4 )).c_str() );
71 
72  TString seff;
73  TString snum;
74  TString sden;
75 
76  TH1F* h1eff(0);
77  TH1F* h1num(0);
78  TH1F* h1den(0);
79  TH2F* h2eff(0);
80  TH2F* h2num(0);
81  TH2F* h2den(0);
82 
83  //===TGCRaw
84  TString tgc_dir = run_dir + "/Muon/MuonRawDataMonitoring/TGC/";
85 
86  TString tgc_global_dir = tgc_dir + "Global/";
87  TString tgc_sub_dir[2] = {
88  tgc_dir + "TGCEA/", tgc_dir + "TGCEC/"
89  };
90 
91  for (int ac = 0; ac < 2; ac++) {
92  TString eff_dir = tgc_sub_dir[ac] + "Efficiency/";
93  TDirectory* dir = mf.GetDirectory(eff_dir);
94  if (!dir) {
95  //std::cerr<< "TGCHistogramDivision: directory "<<eff_dir<<" not found"<<std::endl;
96  return;
97  }
98 
99  ss.str("");
100  ss << "Efficiency" << sac[ac];
101  seff = eff_dir + ss.str();
102  ss.str("");
103  ss << "Efficiency" << sac[ac] << "_Numerator";
104  snum = eff_dir + "NumDenom/" + ss.str();
105  ss.str("");
106  ss << "Efficiency" << sac[ac] << "_Denominator";
107  sden = eff_dir + "NumDenom/" + ss.str();
108 
109  h1eff = 0;
110  mf.get(seff, h1eff);
111  h1num = 0;
112  mf.get(snum, h1num);
113  h1den = 0;
114  mf.get(sden, h1den);
115 
116  if (h1eff && h1num && h1den) {
117  TGCResetContents(h1eff);
118  h1eff->Divide(h1num, h1den, 1., 1., "B");
119 
120  // save the summary histogram
121  dir->cd();
122  h1eff->Write("", TObject::kOverwrite);
123  } else {
124  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
125  continue;
126  }
127 
128  for (int ws = 0; ws < 2; ws++) {
129  ss.str("");
130  ss << sws[ws] << "Efficiency" << sac[ac];
131  seff = eff_dir + ss.str();
132  ss.str("");
133  ss << sws[ws] << "Efficiency" << sac[ac] << "_Numerator";
134  snum = eff_dir + "NumDenom/" + ss.str();
135  ss.str("");
136  ss << sws[ws] << "Efficiency" << sac[ac] << "_Denominator";
137  sden = eff_dir + "NumDenom/" + ss.str();
138 
139  h1eff = 0;
140  mf.get(seff, h1eff);
141  h1num = 0;
142  mf.get(snum, h1num);
143  h1den = 0;
144  mf.get(sden, h1den);
145 
146  if (h1eff && h1num && h1den) {
147  TGCResetContents(h1eff);
148  h1eff->Divide(h1num, h1den, 1., 1., "B");
149 
150  // save the summary histogram
151  dir->cd();
152  h1eff->Write("", TObject::kOverwrite);
153  } else {
154  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
155  continue;
156  }
157  mf.Write();
158 
159  //efficiency map for current, previous and next.
160  std::string sbc[3] = {
161  "_Previous", "", "_Next"
162  };
163  for (int bc = 0; bc < 3; bc++) {
164  ss.str("");
165  ss << sws[ws] << "Efficiency_Map" << sbc[bc] << sac[ac];
166  seff = eff_dir + ss.str();
167  ss.str("");
168  ss << sws[ws] << "Efficiency_Map" << sbc[bc] << sac[ac] << "_Numerator";
169  snum = eff_dir + "NumDenom/" + ss.str();
170  ss.str("");
171  ss << sws[ws] << "Efficiency_Map" << sac[ac] << "_Denominator";
172  sden = eff_dir + "NumDenom/" + ss.str();
173 
174  h2eff = 0;
175  mf.get(seff, h2eff);
176  h2num = 0;
177  mf.get(snum, h2num);
178  h2den = 0;
179  mf.get(sden, h2den);
180 
181  if (h2eff && h2num && h2den) {
182  TGCResetContents(h2eff);
183  h2eff->Divide(h2num, h2den, 1., 1., "B");
184 
185  // save the summary histogram
186  dir->cd();
187  h2eff->Write("", TObject::kOverwrite);
188  } else {
189  //std::cerr <<"TGC PostProcessing: no such histogram (or num/denom)!! "<< seff << std::endl;
190  continue;
191  }
192  }//bc
193  }//ws
194  }//ac
195  //===End TGCRaw
196  }// run_dir loop
197 
198  mf.Write();
199  }

◆ TGCResetContents()

void dqutils::MonitoringFile::TGCResetContents ( TH1 *  h)
static

Definition at line 1121 of file MonitoringFile_TGCPostProcess.cxx.

1121  {
1122  // copy all functions of histogram before resetting
1123  TList* h_funcs;
1124 
1125  h_funcs = dynamic_cast<TList*> (h->GetListOfFunctions()->Clone());
1126  h->Reset();
1127  //now insert these functions back into the hist
1128  TIter iterE(h_funcs);
1129  while ((iterE())) {
1130  h->GetListOfFunctions()->Add(*iterE);
1131  }
1132  delete h_funcs;
1133  // are the functions still valid after list deletion?
1134  //http://root.cern.ch/root/html/TList#TList:_TList should be!
1135  // TIter iterTest(EffBCap->GetListOfFunctions());
1136  // while( iterTest() ) std::cout << (*iterTest)->GetName() << std::endl;
1137  }

◆ TGCSetMetaData()

void dqutils::MonitoringFile::TGCSetMetaData ( TDirectory *  targetDir,
TH1 *  h1,
TH1 *  h2 = 0,
TH1 *  h3 = 0 
)
static

Definition at line 131 of file MonitoringFile_PPFileWrapper.cxx.

131  {
132  TTree* metadata_overview_tr = 0;
133 
134  if (!targetDir || !h1) return;
135 
136  targetDir->GetObject("metadata", metadata_overview_tr);
137  //Fill Metadata for new objs.
138  std::string name_;
139  std::string intervalData_ = "run";
140  std::string chainData_ = "<none>";
141  std::string mergeData_ = "<default>";
142  if (metadata_overview_tr) {
143  OutputMetadata metadata_overview(metadata_overview_tr);
144  char name[99];
145  char intervalData[99];
146  char chainData[99];
147  char mergeData[99];
148  TBranch* b_name;
149  TBranch* b_intervalData;
150  TBranch* b_chainData;
151  TBranch* b_mergeData;
152  TTree* tClone = (TTree*) metadata_overview_tr->Clone();
153  metadata_overview_tr->SetDirectory(0);
154  tClone->SetBranchAddress("Name", name, &b_name);
155  tClone->SetBranchAddress("Interval", intervalData, &b_intervalData);
156  tClone->SetBranchAddress("TriggerChain", chainData, &b_chainData);
157  tClone->SetBranchAddress("MergeMethod", mergeData, &b_mergeData);
158  //Check if Metadata Already Exists
159  bool isMeta = false;
160  for (int i = 0; i != tClone->GetEntries(); ++i) {
161  tClone->GetEntry(i);
162  intervalData_ = intervalData;
163  chainData_ = chainData;
164  mergeData_ = mergeData;
165  name_ = name;
166  if (name_ == (std::string) h1->GetName()) isMeta = true;
167  }
168 
169  delete tClone;
170  if (isMeta) {
171  metadata_overview_tr->SetDirectory(0);
172  delete metadata_overview_tr;
173  return;
174  }
175  metadata_overview.fill(h1->GetName(), intervalData_, chainData_, mergeData_);
176  if (h2) metadata_overview.fill(h2->GetName(), intervalData_, chainData_, mergeData_);
177  if (h3) metadata_overview.fill(h3->GetName(), intervalData_, chainData_, mergeData_);
178  //set new hists to 0 dir
179  TDirectory* tempDir = gDirectory;
180  targetDir->cd();
181  metadata_overview_tr->Write("", TObject::kOverwrite);
182  tempDir->cd();
183  } else {
184  TTree* metadata_overview_tr = new TTree("metadata", "Monitoring Metadata");
185  OutputMetadata metadata_overview(metadata_overview_tr);
186  if (h1) metadata_overview.fill(h1->GetName(), intervalData_, chainData_, mergeData_);
187  TDirectory* tempDir = gDirectory;
188  targetDir->cd();
189  h1->SetDirectory(0);
190  metadata_overview_tr->Write("", TObject::kOverwrite);
191  metadata_overview_tr->SetDirectory(0);//make this safe to delete
192  delete metadata_overview_tr;
193  tempDir->cd();
194  }
195  }

◆ TGCsubsect2sectorphi()

void dqutils::MonitoringFile::TGCsubsect2sectorphi ( int  subsect,
int &  sector,
int &  phi4 
)
static

Definition at line 953 of file MonitoringFile_TGCPostProcess.cxx.

953  {
954  sector = (subsect + 1) / 4 + 1;
955  if (sector > 12) sector = 1;
956  phi4 = (subsect + 1) % 4;
957  }//MonitoringFile::TGCsubsect2sectorphi

◆ TGCsubsectbin2stationeta()

void dqutils::MonitoringFile::TGCsubsectbin2stationeta ( int  subsect,
int  bin,
int &  station,
int &  eta 
)
static

Definition at line 926 of file MonitoringFile_TGCPostProcess.cxx.

926  {
927  if (subsect % 2 == 1) {//including forward chamber
928  if (bin <= 15) {
929  station = 1;
930  eta = (bin - 1) % 5;
931  } else if (bin <= 27) {
932  station = 2;
933  eta = (bin - 16) % 6;
934  } else {
935  station = 3;
936  eta = (bin - 28) % 6;
937  }
938  } else {
939  if (bin <= 12) {
940  station = 1;
941  eta = (bin - 1) % 4 + 1;
942  } else if (bin <= 22) {
943  station = 2;
944  eta = (bin - 13) % 5 + 1;
945  } else {
946  station = 3;
947  eta = (bin - 23) % 5 + 1;
948  }
949  }
950  }//MonitoringFile::TGCsubsectbin2stationeta

◆ VxMon_move()

void dqutils::MonitoringFile::VxMon_move ( const std::string &  inFilename,
bool  isIncremental = false 
)
static

Definition at line 33 of file MonitoringFile_MoveVertexMonitoring.cxx.

33  {
34  std::string stream_ref = "physics_MinBias";
35  int stream_check = -1;
36  stream_check = inFilename.find(stream_ref);
37 
38  if (!isIncremental && stream_check >= 0) {
39  TFile* f = TFile::Open(inFilename.c_str(), "UPDATE");
40  if (f == 0 || !f->IsOpen()) {
41  delete f;
42  return;
43  }
44  if (f->GetSize() < 1000.) {
45  delete f;
46  return;
47  }
48 
49  bool dirExists = false;
50  TString run_dir;
51  TString lb_dir;
52  int writeEOS = 0;
53  int writeLOCAL = -1;
54  bool IsFirstTime = true;
55  std::string AthenaTAG;
56 
57  const char* AtlasVersion = getenv("AtlasVersion");
58  if (!AtlasVersion) {
59  delete f;
60  return;
61  }
62  AthenaTAG = AtlasVersion;
63  std::string out_inStem;
64  std::string out_EOS;
65  std::string out_LOCAL;
66  std::string out_outStem;
67 
68  TIter run_keys(f->GetListOfKeys());
69  TIter lb_keys(f->GetListOfKeys());
70  TKey* key_run(0);
71  TKey* key_lb(0);
72  while ((key_run = dynamic_cast<TKey*>(run_keys())) != 0) {
73  TObject* obj_run = key_run->ReadObj();
74  TDirectory* tdir_run = dynamic_cast<TDirectory*>(obj_run);
75  if (tdir_run != 0) {
76  std::string tdir_run_name(tdir_run->GetName());
77  if (tdir_run_name.find("run") != std::string::npos) {
78  run_dir = tdir_run_name;
79  out_EOS = "root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/perf-idtracking/VertexMonitoring/VxMon_" +
80  run_dir + "_" + AthenaTAG + ".root";
81  out_LOCAL = "VxMon_" + run_dir + "_" + AthenaTAG + ".root";
82 
83  lb_keys = tdir_run->GetListOfKeys();
84  while ((key_lb = dynamic_cast<TKey*>(lb_keys())) != 0) {
85  TObject* obj_lb = key_lb->ReadObj();
86  TDirectory* tdir_lb = dynamic_cast<TDirectory*>(obj_lb);
87  //cout << "tdir_lb " << tdir_lb << endl;
88  if (tdir_lb != 0) {
89  std::string tdir_lb_name(tdir_lb->GetName());
90  //cout << "tdir_lb_name " << tdir_lb_name << endl;
91  if (tdir_lb_name.find("lb") != std::string::npos) {
92  lb_dir = tdir_lb_name;
93 
94  dirExists = f->GetDirectory(run_dir + "/" + lb_dir + "/InDetGlobal/PrimaryVertexMultiplicity");
95  if (dirExists) {
96  out_inStem = run_dir + "/" + lb_dir + "/InDetGlobal/PrimaryVertexMultiplicity/nVx";
97  out_outStem = "nVx_" + lb_dir;
98  if (writeEOS == 0) {
99  writeEOS = updateHists(inFilename, out_inStem, out_EOS, out_outStem);
100  if (writeEOS != 0 && IsFirstTime) writeLOCAL = updateHists(inFilename, out_inStem, out_LOCAL,
101  out_outStem);
102  } else {
103  writeLOCAL = updateHists(inFilename, out_inStem, out_LOCAL, out_outStem);
104  }
105 
106  if (writeEOS != 0 && !IsFirstTime && writeLOCAL != 0) {
107  delete f;
108  return;
109  }
110  ;
111  if (writeEOS != 0 && writeLOCAL != 0) {
112  delete f;
113  return;
114  }
115  ;
116  IsFirstTime = false;
117  }
118  }
119  } else {
120  delete obj_lb;
121  }
122  }
123 
124  if (writeEOS != 0 && writeLOCAL == 0) {
125  int return_code = system(
126  "xrdcp VxMon_" + run_dir + "_" + AthenaTAG + ".root root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/perf-idtracking/VertexMonitoring/VxMon_" + run_dir + "_" + AthenaTAG +
127  ".root");
128  if (return_code == 0) std::ignore = remove(out_LOCAL.c_str()); //returns zero on success
129  else {
130  delete f;
131  return;
132  }
133  }
134  }
135  } else {
136  delete obj_run;
137  }
138  }
139 
140  f->Close();
141  delete f;
142  }
143  return;
144  }

Member Data Documentation

◆ m_cpuPerHistogram

std::unordered_map<std::string,std::clock_t> dqutils::MonitoringFile::m_cpuPerHistogram
staticprivate

Definition at line 452 of file MonitoringFile.h.

◆ m_debugLevel

std::atomic<int> dqutils::MonitoringFile::m_debugLevel
staticprivate

Definition at line 449 of file MonitoringFile.h.

◆ m_doTiming

bool dqutils::MonitoringFile::m_doTiming
staticprivate

Definition at line 451 of file MonitoringFile.h.

◆ m_file

TFile* dqutils::MonitoringFile::m_file {}
protected

Definition at line 419 of file MonitoringFile.h.

◆ m_fileCompressionLevel

std::atomic<int> dqutils::MonitoringFile::m_fileCompressionLevel
staticprivate

Definition at line 450 of file MonitoringFile.h.

◆ m_mergeMatchDirRE

std::regex* dqutils::MonitoringFile::m_mergeMatchDirRE {}
private

Definition at line 445 of file MonitoringFile.h.

◆ m_mergeMatchDirREString

std::string dqutils::MonitoringFile::m_mergeMatchDirREString
private

Definition at line 447 of file MonitoringFile.h.

◆ m_mergeMatchHistoRE

std::regex* dqutils::MonitoringFile::m_mergeMatchHistoRE {}
private

Definition at line 444 of file MonitoringFile.h.

◆ m_mergeMatchHistoREString

std::string dqutils::MonitoringFile::m_mergeMatchHistoREString
private

Definition at line 446 of file MonitoringFile.h.

◆ m_useRE

bool dqutils::MonitoringFile::m_useRE {}
private

Definition at line 448 of file MonitoringFile.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
covarianceTool.ndf
ndf
Definition: covarianceTool.py:678
dqutils::ATLAS_NOT_THREAD_SAFE
void getImageBuffer ATLAS_NOT_THREAD_SAFE(TImage **img, TCanvas *myC, char **x, int *y)
Definition: HanOutputFile.cxx:1130
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
dqutils::MonitoringFile::nTGCWireStripMap
static int nTGCWireStripMap(int ws, int etac, int phi48)
Definition: MonitoringFile_TGCPostProcess.cxx:960
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
dqutils::MonitoringFile::processModule
static void processModule(TFile *f, const std::string &run_dir, TKey *key_module, const std::string &moduleName)
Definition: MonitoringFile_DiMuPostProcess.cxx:115
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
SegStationName
const char *const SegStationName[17]
Definition: MonitoringFile_MuonTrackPostProcess.cxx:39
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
dqutils::MonitoringFile::VERBOSE
@ VERBOSE
Definition: MonitoringFile.h:425
dqutils::updateHists
int updateHists(const std::string &inFileName, const std::string &inStem, const std::string &outFileName="", const std::string &outStem="")
Definition: MonitoringFile_MoveVertexMonitoring.cxx:149
pdg_comparison.sigma
sigma
Definition: pdg_comparison.py:324
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
plotting.plot_kinematics.run_number
run_number
Definition: plot_kinematics.py:29
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
SGout2dot.alg
alg
Definition: SGout2dot.py:243
get_generator_info.result
result
Definition: get_generator_info.py:21
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
run.infile
string infile
Definition: run.py:13
dqutils::MonitoringFile::fitHistos
static void fitHistos(TH2F *hin, const std::vector< TH1F * > &hout, int mode, const std::string &triggerName, const std::string &resonName, TH1F *m_chi2)
Definition: MonitoringFile_DiMuPostProcess.cxx:229
WriteCellNoiseToCool.icell
icell
Definition: WriteCellNoiseToCool.py:339
dqutils::MonitoringFile::HLTMuonHistogramDivision
static void HLTMuonHistogramDivision(const std::string &inFilename, TString &run_dir)
Definition: MonitoringFile_HLTMuonHistogramDivision.cxx:43
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
dqutils::MonitoringFile::meanRMSProjections3D_XY
static void meanRMSProjections3D_XY(TH3F *h3d, TH1F *h, int iXY, int iopt)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3483
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
dqutils::MonitoringFile::CheckHistogram
static bool CheckHistogram(TFile *f, const char *HistoName)
dqutils::MonitoringFile::TGCChamberEfficiency
static void TGCChamberEfficiency(const std::string &inFilename, std::vector< std::pair< std::string, float > > &p)
Definition: MonitoringFile_TGCPostProcess.cxx:367
egammaEnergyPositionAllSamples::e1
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:279
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
index
Definition: index.py:1
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
plotmaker.hist
hist
Definition: plotmaker.py:148
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
StateLessPT_NewConfig.Format
Format
Definition: StateLessPT_NewConfig.py:146
ConvertOldUJHistosToNewHistos.etaBins
list etaBins
Definition: ConvertOldUJHistosToNewHistos.py:145
hsum
double hsum(TH1 *h)
sum the bin contents including the over and underflow bins
Definition: chains.cxx:101
dqutils::MonitoringFile::MDTvsTGCEfficiency
static void MDTvsTGCEfficiency(const std::string &inFilename)
Definition: MonitoringFile_MDTvsTGCPostProcess.cxx:43
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
skel.it
it
Definition: skel.GENtoEVGEN.py:396
dirname
std::string dirname(std::string name)
Definition: utils.cxx:200
test_pyathena.pt
pt
Definition: test_pyathena.py:11
PixelAthClusterMonAlgCfg.ybins
ybins
Definition: PixelAthClusterMonAlgCfg.py:169
bin
Definition: BinsDiffFromStripMedian.h:43
dqutils::MonitoringFile::TGCsubsect2sectorphi
static void TGCsubsect2sectorphi(int subsect, int &sector, int &phi4)
Definition: MonitoringFile_TGCPostProcess.cxx:953
PlotCalibFromCool.ib
ib
Definition: PlotCalibFromCool.py:419
dqutils::MonitoringFile::getDebugLevel
static int getDebugLevel()
dqutils::MonitoringFile::fitMergedFile_IDPerfMonJpsi
static void fitMergedFile_IDPerfMonJpsi(TFile *f, const std::string &run_dir, const std::string &TriggerName)
Definition: MonitoringFile_IDPerfPostProcess.cxx:751
InDet::median
float median(std::vector< float > &Vec)
Definition: BTagVrtSec.cxx:35
GetEntries
TGraphErrors * GetEntries(TH2F *histo)
Definition: TRTCalib_makeplots.cxx:4019
dqutils::MonitoringFile::HLTCaloAveragePtPhiEtaMaps
static void HLTCaloAveragePtPhiEtaMaps(TFile *f, TString &run_dir)
Definition: MonitoringFile_HLTCaloAveragePtPhiEtaMaps.cxx:24
read_hist_ntuple.h1
h1
Definition: read_hist_ntuple.py:21
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
x
#define x
CaloSwCorrections.gap
def gap(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:212
hmean
double hmean(TH1 *h)
Definition: computils.cxx:434
TrigVSI::AlgConsts::nPhi
constexpr int nPhi
Default bin number of phi for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:27
TwoDto1D_Mean
void TwoDto1D_Mean(TH2 *h_parent, TH1 *h_child, int rebinning=1)
Definition: MonitoringFile_MuonTrackPostProcess.cxx:116
dqutils::MonitoringFile::TGCChamberTiming
static void TGCChamberTiming(const std::string &inFilename, std::vector< std::pair< std::string, float > > &pro, std::vector< std::pair< std::string, float > > &ptrg)
Definition: MonitoringFile_TGCPostProcess.cxx:609
dqutils::MonitoringFile::Make1DProfile
static void Make1DProfile(TH1 *output, TH2 *histo)
Definition: MonitoringFile_IDAlignPostProcess.cxx:2944
dqutils::MonitoringFile::setMinWindow
static void setMinWindow(TH1 *h1, float min, float max)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3662
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
dqutils::MonitoringFile::meanRMSProjections3D
static void meanRMSProjections3D(TH3F *h3d, TH2F *h, int iopt)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3248
dqutils::MonitoringFile::HLTEgammaEfficiencyOff
static void HLTEgammaEfficiencyOff(TFile *f, TDirectory *trig_dir, TDirectory *off_dir, const TString &pathNum, const TString &pathEff, const std::vector< TString > &varName)
Definition: MonitoringFile_HLTEgammaEfficiency.cxx:28
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
dqutils::MonitoringFile::MakeMap
static void MakeMap(TH2 *outputhist, TH3 *hist)
Definition: MonitoringFile_IDAlignPostProcess.cxx:2963
DeMoUpdate.reverse
reverse
Definition: DeMoUpdate.py:563
dqutils::MonitoringFile::MuonTrack_Main
static void MuonTrack_Main(const std::string &inFileName, TString dirname)
Definition: MonitoringFile_MuonTrackPostProcess.cxx:217
dqutils::MonitoringFile::TGCChamberOccupancy
static void TGCChamberOccupancy(const std::string &inFilename, std::vector< std::pair< std::string, float > > &phigh, std::vector< std::pair< std::string, float > > &plow)
Definition: MonitoringFile_TGCPostProcess.cxx:82
DQPostProcessTest.mf
mf
Definition: DQPostProcessTest.py:19
TRT::Hit::side
@ side
Definition: HitInfo.h:83
LArCellBinning_test.retval
def retval
Definition: LArCellBinning_test.py:112
dqutils::MonitoringFile::meanRMSProjections2D
static void meanRMSProjections2D(TH2F *h2d, TH1F *h, int iopt)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3129
dqutils::MonitoringFile::fitMergedFile_IDPerfMonZee
static void fitMergedFile_IDPerfMonZee(TFile *f, const std::string &run_dir, const std::string &TriggerName)
Definition: MonitoringFile_IDPerfPostProcess.cxx:1554
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
dqutils::MonitoringFile::fitMergedFile_IDPerfMonZMM
static void fitMergedFile_IDPerfMonZMM(TFile *f, const std::string &run_dir, const std::string &TriggerName)
Definition: MonitoringFile_IDPerfPostProcess.cxx:1955
sTgcDigitEffiDump.effi
list effi
Definition: sTgcDigitEffiDump.py:38
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
DiTauMassTools::ignore
void ignore(T &&)
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:58
systematicsTool.writeToFile
def writeToFile(histDict, fOut)
Definition: systematicsTool.py:1035
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
xAOD::StripCluster
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
Definition: StripCluster.h:13
CalibDbCompareRT.cool_tag
cool_tag
Definition: CalibDbCompareRT.py:12
dqutils::MonitoringFile::TGCRawHistogramDivision
static void TGCRawHistogramDivision(const std::string &inFilename)
Definition: MonitoringFile_TgcHistogramDivision.cxx:39
PlotCalibFromCool.nentries
nentries
Definition: PlotCalibFromCool.py:798
dqutils::MonitoringFile::IterativeGaussFit
static int IterativeGaussFit(TH1 *hist, double &mu, double &mu_err, double &sigma, double &sigma_err)
Definition: MonitoringFile_IDAlignPostProcess.cxx:2998
dqutils::MonitoringFile::fitMergedFile_DiMuMonAll
static void fitMergedFile_DiMuMonAll(TFile *f, const std::string &run_dir, const std::string &resonName, const std::string &triggerName)
Definition: MonitoringFile_DiMuPostProcess.cxx:133
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
dqutils::MonitoringFile::fitZmumuMass
static std::pair< RooRealVar, RooRealVar > fitZmumuMass(TH1F *hmass)
Definition: MonitoringFile_IDPerfPostProcess.cxx:2225
python.getCurrentFolderTag.fn
fn
Definition: getCurrentFolderTag.py:65
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
dqutils::MonitoringFile::fitZmumuHistograms
static void fitZmumuHistograms(TH1F *hmass, TH1F *hwidth, std::vector< TH1F * > hvec)
Definition: MonitoringFile_IDPerfPostProcess.cxx:2201
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
ParseInputs.gDirectory
gDirectory
Definition: Final2012/ParseInputs.py:133
lumiFormat.i
int i
Definition: lumiFormat.py:85
trigmenu_modify_prescale_json.fp
fp
Definition: trigmenu_modify_prescale_json.py:53
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
dqutils::MonitoringFile::fitMergedFile_IDAlignMonPVbiases
static void fitMergedFile_IDAlignMonPVbiases(TFile *file, const std::string &run_dir, const std::string &tracksName)
Definition: MonitoringFile_IDAlignPostProcess.cxx:2515
CheckAppliedSFs.bmin
bmin
Definition: CheckAppliedSFs.py:242
dqutils::plotResolution
void plotResolution(const TString &coordinate, const TString &versus)
Definition: MonitoringFile_IDEnhancedPrimaryVertex.cxx:107
beamspotman.n
n
Definition: beamspotman.py:731
PixelAthClusterMonAlgCfg.varName
string varName
end cluster ToT and charge
Definition: PixelAthClusterMonAlgCfg.py:125
checkxAOD.frac
frac
Definition: Tools/PyUtils/bin/checkxAOD.py:259
fitman.bx
bx
Definition: fitman.py:410
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
dqutils::MonitoringFile::fitMergedFile_IDAlignMonResiduals
static void fitMergedFile_IDAlignMonResiduals(TFile *f, const std::string &run_dir, const std::string &TriggerName)
Definition: MonitoringFile_IDAlignPostProcess.cxx:473
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
covarianceTool.title
title
Definition: covarianceTool.py:542
master.flag
bool flag
Definition: master.py:29
SignEnum::LE
@ LE
Definition: SignEnums.h:21
plotBeamSpotCompare.ivar
int ivar
Definition: plotBeamSpotCompare.py:383
dqutils::MonitoringFile::combineHistos
static TH1F * combineHistos(const char *name, const char *title, TObjArray *plots, int gap)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3617
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:523
BindingsTest.cut
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.
Definition: BindingsTest.py:13
dqutils::MonitoringFile::HLTEgammaEfficiencyRel
static void HLTEgammaEfficiencyRel(TFile *f, TDirectory *trig_dir, const TString &pathPre, const TString &pathRej, const std::vector< TString > &objStage, const std::vector< TString > &varName)
Definition: MonitoringFile_HLTEgammaEfficiency.cxx:116
file
TFile * file
Definition: tile_monitor.h:29
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
dqutils::MonitoringFile::L1CaloStabilityRMS
static void L1CaloStabilityRMS(TFile *f, const TString &nameDir, const TString &nameTag)
Definition: MonitoringFile_L1CaloPostProcess.cxx:128
dqutils::MonitoringFile::getPath
static std::string getPath(TDirectory *dir)
Preparation.mode
mode
Definition: Preparation.py:94
dqutils::MonitoringFile::TGCResetContents
static void TGCResetContents(TH1 *h)
Definition: MonitoringFile_TGCPostProcess.cxx:1121
SwapComponents.newHists
list newHists
Definition: SwapComponents.py:36
hist_file_dump.f
f
Definition: hist_file_dump.py:135
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
dqutils::MonitoringFile::fitMergedFile_IDPerfMonUpsilon
static void fitMergedFile_IDPerfMonUpsilon(TFile *f, const std::string &run_dir, const std::string &TriggerName)
Definition: MonitoringFile_IDPerfPostProcess.cxx:1191
dqutils::MonitoringFile::meanRMSProjections3D_DMRPlot
static void meanRMSProjections3D_DMRPlot(TH3F *h3d, TH1F *h, int iopt)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3380
DQHistogramMerge.debugLevel
debugLevel
Definition: DQHistogramMerge.py:41
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
SetMassInfo
void SetMassInfo(int iBin, TH1 *InputHist, TH1 *OutMean, TH1 *OutSigma, TString recalg_path)
Definition: MonitoringFile_MuonTrackPostProcess.cxx:168
dqutils::MonitoringFile::MDTvsTGCResetContents
static void MDTvsTGCResetContents(TH1 *h)
Definition: MonitoringFile_MDTvsTGCPostProcess.cxx:232
compute_lumi.denom
denom
Definition: compute_lumi.py:76
dqutils::MonitoringFile::none
@ none
Definition: MonitoringFile.h:425
dqutils::MonitoringFile::fillGaussianMeanOrWidth
static void fillGaussianMeanOrWidth(TH2F *h2d, TH1F *h, float fitMin, float fitMax, int iopt)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3750
MuonValidation_CreateResolutionProfiles.fit
def fit(h, emin, emax)
Definition: MuonValidation_CreateResolutionProfiles.py:69
dqutils::MonitoringFile::HLTTauPostProcess
static void HLTTauPostProcess(const std::string &inFilename, bool isIncremental=false)
Definition: MonitoringFile_HLTTauPostProcess.cxx:28
dqutils::MonitoringFile::HLTMETGetStatusPerBin
static int HLTMETGetStatusPerBin(TH1I *&hist, int ymin, int ymax, int rmin, int rmax)
Definition: MonitoringFile_HLTMETDQFlagSummary.cxx:271
beamspotman.dir
string dir
Definition: beamspotman.py:623
Set
struct _Set Set
Represents a set of values.
Definition: set.h:59
mergePhysValFiles.errors
list errors
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:43
dqutils::MonitoringFile::TGCLV1HistogramDivision
static void TGCLV1HistogramDivision(const std::string &inFilename)
Definition: MonitoringFile_TgcHistogramDivision.cxx:202
merge.output
output
Definition: merge.py:17
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
dumpTgcDigiJitter.nBins
list nBins
Definition: dumpTgcDigiJitter.py:29
dqutils::MonitoringFile::RPCCheckHistogram
static bool RPCCheckHistogram(TFile *f, const char *HistoName)
Definition: MonitoringFile_RPCPostProcess.cxx:1666
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
dqutils::MonitoringFile::HLTJetCalcEfficiencyAndRate
static void HLTJetCalcEfficiencyAndRate(TFile *f, TString &run_dir)
Definition: MonitoringFile_HLTJetCalcEfficiencyAndRate.cxx:36
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
dqutils::MonitoringFile::ProcessAsymHistograms
static void ProcessAsymHistograms(TH1F *m_neg, TH1F *m_pos, TH1F *m_asym)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3107
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
threshold
Definition: chainparser.cxx:74
dqutils::MonitoringFile::L1CaloResetEfficiencies
static void L1CaloResetEfficiencies(TFile *f, const TString &effDir, const TString &nameDen, const TString &nameEff, int items, double threshold, int binSkip)
Definition: MonitoringFile_L1CaloPostProcess.cxx:202
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
dqutils::MonitoringFile::HLTMuonHDiv
static void HLTMuonHDiv(PostProcessorFileWrapper &mf, TString sdir, TString snum, TString sden, TString seff, TString seffg)
Definition: MonitoringFile_HLTMuonHistogramDivision.cxx:1722
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
dqutils::MonitoringFile::L1CaloFillWithError
static void L1CaloFillWithError(TFile *f, const TString &nameDir, const TString &nameData, const TString &nameError)
Definition: MonitoringFile_L1CaloPostProcess.cxx:141
L1CALOPOSTPROCESSDEBUG
#define L1CALOPOSTPROCESSDEBUG
Definition: MonitoringFile_L1CaloPostProcess.cxx:22
LArCellBinning.xbins
int xbins
Definition: LArCellBinning.py:163
python.copyTCTOutput.chains
chains
Definition: copyTCTOutput.py:81
Rtt_histogram.n1
n1
Definition: Rtt_histogram.py:21
ReadCellNoiseFromCoolCompare.v2
v2
Definition: ReadCellNoiseFromCoolCompare.py:364
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
DeMoScan.index
string index
Definition: DeMoScan.py:364
dqutils::MonitoringFile::DEBUG
@ DEBUG
Definition: MonitoringFile.h:425
a
TList * a
Definition: liststreamerinfos.cxx:10
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
y
#define y
h
StateLessPT_NewConfig.Layout
Layout
Definition: StateLessPT_NewConfig.py:159
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
egammaEnergyPositionAllSamples::e2
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
dqutils::MonitoringFile::HLTMETDQFlagSummary
static void HLTMETDQFlagSummary(TFile *f, TString &run_dir)
Definition: MonitoringFile_HLTMETDQFlagSummary.cxx:42
TwoDto2D_Eff
void TwoDto2D_Eff(TH2 *Numerator, TH2 *Denominator, TH2 *Efficiency, bool rebin2d=false)
Definition: MonitoringFile_MuonTrackPostProcess.cxx:84
dqutils::MonitoringFile::m_fileCompressionLevel
static std::atomic< int > m_fileCompressionLevel
Definition: MonitoringFile.h:450
dqutils::MonitoringFile::BJetTaggingAdjustRanges
static void BJetTaggingAdjustRanges(TFile *f)
Definition: MonitoringFile_BJetTaggingAdjustRanges.cxx:27
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
dqutils::MonitoringFile::fitUpsilonHistograms
static void fitUpsilonHistograms(TH1F *hmass, TH1F *hwidth, TH1F *h1[], int n)
Definition: MonitoringFile_IDPerfPostProcess.cxx:2152
DeMoScan.first
bool first
Definition: DeMoScan.py:536
python.TriggerAPI.TriggerAPISession.chainName
chainName
Definition: TriggerAPISession.py:426
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
dqutils::MonitoringFile::HLTMinBiasMonGetTargetHistos
static void HLTMinBiasMonGetTargetHistos(TDirectory *source, std::vector< std::pair< TString, TString > > &targetNames)
Definition: MonitoringFile_HLTMinBiasMonPostProcess.cxx:143
DetectorZone::barrel
@ barrel
dqutils::MonitoringFile::HLTMETGetDQLBNRange
static size_t HLTMETGetDQLBNRange(TDirectory *&run_dir, std::vector< TString > &lbnDirs)
Definition: MonitoringFile_HLTMETDQFlagSummary.cxx:240
dqutils::plotEfficiency
void plotEfficiency()
Definition: MonitoringFile_IDEnhancedPrimaryVertex.cxx:375
beamspotnt.rms
rms
Definition: bin/beamspotnt.py:1266
entries
double entries
Definition: listroot.cxx:49
covarianceTool.plots
plots
Definition: covarianceTool.py:698
dqutils::MonitoringFile::fitJpsiHistograms
static void fitJpsiHistograms(TH1F *hmass, TH1F *hwidth, TH1F *h1[], int n)
Definition: MonitoringFile_IDPerfPostProcess.cxx:2096
extractSporadic.nameDir
string nameDir
Definition: extractSporadic.py:85
CxxUtils::atoi
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Definition: Control/CxxUtils/Root/StringUtils.cxx:85
dqt_zlumi_alleff_HIST.eff
int eff
Definition: dqt_zlumi_alleff_HIST.py:113
copySelective.source
string source
Definition: copySelective.py:32
str
Definition: BTagTrackIpAccessor.cxx:11
LArG4GenerateShowerLib.nevents
nevents
Definition: LArG4GenerateShowerLib.py:19
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition: checker_macros.h:211
dqutils::MonitoringFile::HLTMETAveragePhivsEtaMaps
static void HLTMETAveragePhivsEtaMaps(TFile *f, TString &run_dir)
Definition: MonitoringFile_HLTMETAveragePhivsEtaMaps.cxx:38
dqutils::MonitoringFile::fitMergedFile_IDPerfMonKshort
static void fitMergedFile_IDPerfMonKshort(TFile *f, const std::string &run_dir, const std::string &TriggerName)
Definition: MonitoringFile_IDPerfPostProcess.cxx:301
dqutils::MonitoringFile::fitMergedFile_IDPerfMonWenu
static void fitMergedFile_IDPerfMonWenu(TFile *f, const std::string &run_dir, const std::string &TriggerName)
Definition: MonitoringFile_IDPerfPostProcess.cxx:1754
dqutils::MonitoringFile::getTGCNumberOfWires
static int getTGCNumberOfWires(const int istationName, const int layer, const int istationEta, const int istationPhi)
Definition: MonitoringFile_TGCPostProcess.cxx:1036
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
TrigVSI::AlgConsts::nEta
constexpr int nEta
Default bin number of eta for vertex map.
Definition: Trigger/TrigTools/TrigVrtSecInclusive/TrigVrtSecInclusive/Constants.h:26
hotSpotInTAG.nb
nb
Definition: hotSpotInTAG.py:164
plotBeamSpotCompare.histo
histo
Definition: plotBeamSpotCompare.py:415
dqBeamSpot.nEntries
int nEntries
Definition: dqBeamSpot.py:73
python.PyAthena.obj
obj
Definition: PyAthena.py:132
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
error
Definition: IImpactPoint3dEstimator.h:70
dqutils::MonitoringFile::getNumBins
static Int_t getNumBins(const TH1 &hist)
Definition: MonitoringFile_MergeAlgs.cxx:47
python.compressB64.c
def c
Definition: compressB64.py:93
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
PlotCalibFromCool.be
be
Definition: PlotCalibFromCool.py:398
MooRTT_summarizeCPU.muid
int muid
Definition: MooRTT_summarizeCPU.py:44
DQHistogramMerge.isIncremental
isIncremental
Definition: DQHistogramMerge.py:37
dqutils::MonitoringFile::HLTMuonTriggerOverlapMatrix
static void HLTMuonTriggerOverlapMatrix(const std::string &inFilename, TString &run_dir)
Definition: MonitoringFile_HLTMuonPostProcess.cxx:71
readCCLHist.float
float
Definition: readCCLHist.py:83
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34
plot_times.times
def times(fn)
Definition: plot_times.py:11
dqutils::MonitoringFile::getMedian
static float getMedian(TH1 *h1)
Definition: MonitoringFile_IDAlignPostProcess.cxx:3679
dqutils::MonitoringFile::BJetTaggingNormalise
static void BJetTaggingNormalise(TFile *f)
Definition: MonitoringFile_BJetTaggingNormalise.cxx:25
fitman.k
k
Definition: fitman.py:528
dqutils::MonitoringFile::fitMergedFile_IDAlignMonTrackSegments
static void fitMergedFile_IDAlignMonTrackSegments(TFile *file, const std::string &run_dir, const std::string &tracksName)
Definition: MonitoringFile_IDAlignPostProcess.cxx:179
TwoDto1D_Sum
void TwoDto1D_Sum(TH2 *h_parent, TH1 *h_child, int rebinning=2)
Definition: MonitoringFile_MuonTrackPostProcess.cxx:144
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
module_driven_slicing.key1
key1
Definition: module_driven_slicing.py:158