ATLAS Offline Software
Loading...
Searching...
No Matches
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
class  PostProcessorFileWrapper

Public Types

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

Public Member Functions

 MonitoringFile ()
 MonitoringFile (const std::string &fileName)
virtual ~MonitoringFile ()
int mergeFiles (const std::string &outFileName, const std::vector< std::string > &files, fileLBMap_t &lbMap, bool fillLBDirs=true)
int 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.
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.
virtual void printHanConfig ()
virtual std::string FindCommon (const std::string &name1, const std::string &name2) const
int mergeLBintervals (const std::string &inFilename)
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.
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 getDebugLevel ()
static void setDebugLevel (int level)
static int getCompressionLevel ()
static void setCompressionLevel (int level)
static void setCheckEquality (bool value)

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

typedef std::map< TDirectory *, std::vector< TDirectory * > > map_dir_vdir

Private Member Functions

std::map< std::string, std::vector< std::string > > buildLBToIntervalMap (TDirectory *runDir)
int mergeLB_processLBinterval (TFile *file, const std::vector< std::string > &inputDirNames, const std::string &outputDirName)

Static Private Member Functions

static Int_t getNumBins (const TH1 &hist)

Private Attributes

debugLevel_t m_dbgLvl {none}
std::optional< std::regex > m_mergeMatchHistoRE
std::optional< std::regex > m_mergeMatchDirRE

Static Private Attributes

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

Detailed Description

Definition at line 59 of file MonitoringFile.h.

Member Typedef Documentation

◆ DirMap_t

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

Definition at line 95 of file MonitoringFile.h.

◆ map_dir_vdir

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

Definition at line 430 of file MonitoringFile.h.

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 29 of file MonitoringFile_BJetTaggingAdjustRanges.cxx.

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

◆ 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 }
TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)

◆ 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()

std::map< std::string, std::vector< std::string > > dqutils::MonitoringFile::buildLBToIntervalMap ( TDirectory * runDir)
private

◆ CheckHistogram()

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 }
gap(flags, cells_name, *args, **kw)

◆ 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()

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

◆ dirHasHistogramsInMetadata()

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 }
double hmean(TH1 *h)

◆ 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 }
const double width
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="")

◆ 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()

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 const 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 }
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
double chi2(TH1 *h0, TH1 *h1)

◆ fitJpsiHistograms()

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

Definition at line 2089 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ 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 }
static const std::vector< std::string > regions
static void fitHistos(TH2F *hin, const std::vector< TH1F * > &hout, int mode, const std::string &triggerName, const std::string &resonName, TH1F *m_chi2)
static bool CheckHistogram(TFile *f, const char *HistoName)
path
python interpreter configuration --------------------------------------—
Definition athena.py:128

◆ 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 = std::move(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 }
static void processModule(TFile *f, const std::string &run_dir, TKey *key_module, const std::string &moduleName)

◆ 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 }
static void ProcessAsymHistograms(TH1F *m_neg, TH1F *m_pos, TH1F *m_asym)
TFile * file

◆ 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 = std::move(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 }
static void fitMergedFile_IDAlignMonResiduals(TFile *f, const std::string &run_dir, const std::string &TriggerName)
static void fitMergedFile_IDAlignMonPVbiases(TFile *file, const std::string &run_dir, const std::string &tracksName)
static void fitMergedFile_IDAlignMonTrackSegments(TFile *file, const std::string &run_dir, const std::string &tracksName)

◆ 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 }
static void Make1DProfile(TH1 *output, TH2 *histo)
static void MakeMap(TH2 *outputhist, TH3 *hist)

◆ 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 }
static void fillGaussianMeanOrWidth(TH2F *h2d, TH1F *h, float fitMin, float fitMax, int iopt)
static void meanRMSProjections3D(TH3F *h3d, TH2F *h, int iopt)
static void setMinWindow(TH1 *h1, float min, float max)
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 meanRMSProjections2D(TH2F *h2d, TH1F *h, int iopt)

◆ 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 }
constexpr int pow(int base, int exp) noexcept

◆ fitMergedFile_IDPerfMonJpsi()

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

Definition at line 744 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ fitMergedFile_IDPerfMonKshort()

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

Definition at line 294 of file MonitoringFile_IDPerfPostProcess.cxx.

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

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

◆ fitMergedFile_IDPerfMonUpsilon()

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

Definition at line 1184 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ fitMergedFile_IDPerfMonWenu()

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

Definition at line 1747 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ fitMergedFile_IDPerfMonZee()

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

Definition at line 1547 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ fitMergedFile_IDPerfMonZMM()

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

Definition at line 1948 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ fitUpsilonHistograms()

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

Definition at line 2145 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ fitZmumuHistograms()

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

Definition at line 2195 of file MonitoringFile_IDPerfPostProcess.cxx.

2195 {
2196 const double ZPDGmass = 91.1876;
2197 const int size = (int) hvec.size();
2198
2199 for (int i = 0; i < size; i++) {
2200 double mass = fitZmumuMass(hvec[i]).first.getVal() - ZPDGmass;
2201 double mass_err = fitZmumuMass(hvec[i]).first.getError();
2202 double width = fitZmumuMass(hvec[i]).second.getVal();
2203 double width_err = fitZmumuMass(hvec[i]).second.getError();
2204
2205 hmass->SetBinContent(i + 1, mass);
2206 hmass->SetBinError(i + 1, mass_err);
2207 hmass->GetXaxis()->SetBinLabel(i + 1, hvec[i]->GetName());
2208 hmass->GetXaxis()->SetTitle("Different Detector Regions");
2209 hmass->SetAxisRange(-3.0, 3.0, "Y");
2210
2211 hwidth->SetBinContent(i + 1, width);
2212 hwidth->SetBinError(i + 1, width_err);
2213 hwidth->GetXaxis()->SetBinLabel(i + 1, hvec[i]->GetName());
2214 hwidth->GetXaxis()->SetTitle("Different Detector Regions");
2215 hwidth->SetAxisRange(0, 8, "Y");
2216 }
2217 }
static std::pair< RooRealVar, RooRealVar > fitZmumuMass(TH1F *hmass)

◆ fitZmumuMass()

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

Definition at line 2219 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ fitZmumuMassPlot()

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

Definition at line 2252 of file MonitoringFile_IDPerfPostProcess.cxx.

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

◆ getAllDirs()

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

◆ getCompressionLevel()

int dqutils::MonitoringFile::getCompressionLevel ( )
inlinestatic

Definition at line 449 of file MonitoringFile.h.

static std::atomic< int > m_fileCompressionLevel

◆ getDebugLevel()

int dqutils::MonitoringFile::getDebugLevel ( )
static

◆ getHanResults()

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()

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 }
#define y
#define x
float median(std::vector< float > &Vec)

◆ getNumBins()

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

Definition at line 58 of file MonitoringFile_MergeAlgs.cxx.

59{
60 // Return number of histogram bins in ROOT 1-dim projection scheme
61 // Allow loops on multi-dim histograms without regard for dimensionality
62 Int_t dim = hist.GetDimension();
63 if (dim == 1) {
64 return (hist.GetNbinsX()+2);
65 }
66 if (dim == 2) {
67 return (hist.GetNbinsX()+2)*(hist.GetNbinsY()+2);
68 }
69 if (dim == 3) {
70 return (hist.GetNbinsX()+2)*(hist.GetNbinsY()+2)*(hist.GetNbinsZ()+2);
71 }
72 return -1;
73}

◆ getObjKey()

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

◆ getPath()

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 1034 of file MonitoringFile_TGCPostProcess.cxx.

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

◆ 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;
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 }
static void HLTCaloAveragePtPhiEtaMaps(TFile *f, TString &run_dir)

◆ 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 }
unsigned int uint
static std::string getPath(TDirectory *dir)
str varName
end cluster ToT and charge

◆ 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 }
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)

◆ 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 }
static void HLTJetCalcEfficiencyAndRate(TFile *f, TString &run_dir)

◆ 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
static int HLTMETGetStatusPerBin(TH1I *&hist, int ymin, int ymax, int rmin, int rmax)
static size_t HLTMETGetDQLBNRange(TDirectory *&run_dir, std::vector< TString > &lbnDirs)
std::string label(const std::string &format, int i)
Definition label.h:19
bool flag
Definition master.py:29

◆ 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 }
static void HLTMETDQFlagSummary(TFile *f, TString &run_dir)
static void HLTMETAveragePhivsEtaMaps(TFile *f, TString &run_dir)

◆ 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 }
static void HLTMinBiasMonGetTargetHistos(TDirectory *source, std::vector< std::pair< TString, TString > > &targetNames)
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]

◆ 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 }
92 HLTMinBiasMonGetTargetHistos(gDirectory, *v_targetNames);
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 1724 of file MonitoringFile_HLTMuonHistogramDivision.cxx.

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

◆ 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#if 0
691 for (int trg = 0; trg < maxindep; trg++) {
692 sden = nd_dir + chainName + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered_Denominator";
693
694 for (int alg = 0; alg < 3; alg++) {
695 snum = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered_Numerator";
696 seff = eff_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered";
697 seffg = seff + "_Fit"; // YY added 20.04.10
698 stmp = chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered";
699 stmpg = chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + trigger[trg] + "_Triggered" + "_Fit";
700 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
701 if (!h1num) continue;
702
703 h1tmp = (TH1F*) h1den->Clone();
704 h1tmp->SetName(stmp);
705 h1tmp->SetTitle(stmp);
706 h1tmp->GetYaxis()->SetTitle("Efficiency");
707 h1tmp->Reset();
708 h1tmp->Divide(h1num, h1den, 1., 1., "B");
709 dir->cd();
710 h1tmp->Write();
711 h1tmpg = new TGraphAsymmErrors();
712 h1tmpg->SetName(stmpg);
713 h1tmpg->SetMarkerStyle(20);
714 h1tmpg->SetMinimum(0.0);
715 h1tmpg->SetMaximum(1.05);
716 h1tmpg->BayesDivide(h1num, h1den);
717 h1tmpg->GetYaxis()->SetTitle("Efficiency");
718 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
719 dir->cd();
720 h1tmpg->Write();
721 delete h1tmpg;
722
723 // summary for jet trigger
724 if (0 == alg || 2 == alg) {
725 if (3 == trg) { // jet
726 double sumeff {}, sumerr {};
727 double sumn = h1num->Integral(iMSL, iMSH);
728 double sumd = h1den->Integral(iMSL, iMSH);
729 if (sumd != 0.) {
730 sumeff = (double) sumn / (double) sumd;
731 sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
732 }
733 int iholx = -1;
734 if (0 == alg) {
735 iholx = static_cast<int>(iL2MuonSA);
736 } else if (2 == alg) {
737 iholx = static_cast<int>(iEFSA);
738 }
739
740 if (iholx >= 0) {
741 TString s = eff_dir + chainName + "_highpt_effsummary_by" + vectkwd.at(2);
742 h1sumeff = getHPointer(s);
743 if (!h1sumeff) continue;
744
745 h1sumeff->SetBinContent(iholx + 1, sumeff);
746 h1sumeff->SetBinError(iholx + 1, sumerr);
747 h1sumeff->GetYaxis()->SetTitleOffset(1.3);
748 h1sumeff->SetMinimum(0.0);
749 h1sumeff->SetMaximum(1.05);
750 // saving
751 dir->cd();
752 h1sumeff->Write("", TObject::kOverwrite);
753 }
754 }
755 }
756 }//alg
757 }//trg
758#endif
759 mf.Write();
760
761 for (int alg = 0; alg < 3; alg++) {
762 //wrt MuidSA
763 sden = nd_dir + chainName + "_Turn_On_Curve_wrt_MuidSA_Denominator";
764 snum = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_Numerator";
765 seff = eff_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA";
766 seffg = seff + "_Fit"; // YY added 20.04.10
767 stmp = chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA";
768 stmpg = chainName + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
769 const auto & [pNum, pDen] = getHistogramPair(snum, sden);
770 if (!pNum) continue;
771
772 h1tmp = (TH1F*) pDen->Clone();
773 h1tmp->SetName(stmp);
774 h1tmp->SetTitle(stmp);
775 h1tmp->GetYaxis()->SetTitle("Efficiency");
776 h1tmp->Reset();
777 h1tmp->Divide(pNum, pDen, 1., 1., "B");
778 dir->cd();
779 h1tmp->Write();
780 h1tmpg = new TGraphAsymmErrors();
781 h1tmpg->SetName(stmpg);
782 h1tmpg->SetMarkerStyle(20);
783 h1tmpg->SetMinimum(0.0);
784 h1tmpg->SetMaximum(1.05);
785 h1tmpg->BayesDivide(pNum, pDen);
786 h1tmpg->GetYaxis()->SetTitle("Efficiency");
787 h1tmpg->GetXaxis()->SetTitle(pDen->GetXaxis()->GetTitle());
788 dir->cd();
789 h1tmpg->Write();
790 delete h1tmpg;
791
792 if (0 == alg || 2 == alg) { // no condition on ES bits = all events
793 double sumeff {}, sumerr {};
794 double sumn = pNum->Integral(iMSL, iMSH);
795 double sumd = pDen->Integral(iMSL, iMSH);
796 if (sumd != 0.) {
797 sumeff = (double) sumn / (double) sumd;
798 sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
799 }
800 int iholx = -1;
801 if (0 == alg) {
802 iholx = static_cast<int>(iL2MuonSA);
803 } else if (2 == alg) {
804 iholx = static_cast<int>(iEFSA);
805 }
806
807 if (iholx >= 0) {
808 TString s = eff_dir + chainName + "_highpt_effsummary_by" + vectkwd.at(3);
809 h1sumeff = getHPointer(s);
810 if (!h1sumeff) continue;
811 h1sumeff->GetYaxis()->SetTitleOffset(1.3);
812 h1sumeff->SetBinContent(iholx + 1, sumeff);
813 h1sumeff->SetBinError(iholx + 1, sumerr);
814 h1sumeff->SetMinimum(0.0);
815 h1sumeff->SetMaximum(1.05);
816 // saving
817 dir->cd();
818 h1sumeff->Write("", TObject::kOverwrite);
819 }
820 }
821 //wrt MuidSA
822
823 // for ES ----------------------------------------------------------------
824 for (int ies = 0; ies <= maxESbr; ies++) {
825 if (!MS_mon_ESbr[ies]) continue;
826 // for ES, L1 ------------------------------------------------------------
827 if (0 == alg) {
828 sden = nd_dir + chainName + triggerES[ies] + "_Turn_On_Curve_wrt_MuidSA_Denominator";
829 snum = nd_dir + chainName + triggerES[ies] + "_L2MuonSA" + "_Turn_On_Curve_wrt" + "_L1" + "_Denominator";
830 seff = eff_dir + chainName + triggerES[ies] + "_L1" + "_Turn_On_Curve_wrt_MuidSA";
831 seffg = seff + "_Fit";
832 stmp = chainName + triggerES[alg] + "_L1" + "_Turn_On_Curve_wrt_MuidSA";
833 stmpg = chainName + triggerES[alg] + "_L1" + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
834 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
835 if (!h1num) continue;
836
837 h1tmp = (TH1F*) h1den->Clone();
838 h1tmp->SetName(stmp);
839 h1tmp->SetTitle(stmp);
840 h1tmp->GetYaxis()->SetTitle("Efficiency");
841 h1tmp->Reset();
842 h1tmp->Divide(h1num, h1den, 1., 1., "B");
843 dir->cd();
844 h1tmp->Write();
845 h1tmpg = new TGraphAsymmErrors();
846 h1tmpg->SetName(stmpg);
847 h1tmpg->SetMarkerStyle(20);
848 h1tmpg->SetMinimum(0.0);
849 h1tmpg->SetMaximum(1.05);
850 h1tmpg->BayesDivide(h1num, h1den);
851 h1tmpg->GetYaxis()->SetTitle("Efficiency");
852 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
853 dir->cd();
854 h1tmpg->Write();
855 delete h1tmpg;
856
857
858 for (int be = 0; be < 2; be++) {
859 sden = nd_dir + chainName + triggerES[ies] + "_Turn_On_Curve_wrt_MuidSA" + bestr[be] + "_Denominator";
860 snum = nd_dir + chainName + triggerES[ies] + "_L2MuonSA" + "_Turn_On_Curve_wrt" + "_L1" + bestr[be] +
861 "_Denominator";
862 seff = eff_dir + chainName + triggerES[ies] + "_L1" + bestr[be] + "_Turn_On_Curve_wrt_MuidSA";
863 seffg = seff + "_Fit";
864 stmp = chainName + triggerES[ies] + "_L1" + bestr[be] + "_Turn_On_Curve_wrt_MuidSA";
865 stmpg = chainName + triggerES[ies] + "_L1" + bestr[be] + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
866 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
867 if (!h1num) continue;
868
869 h1tmp = (TH1F*) h1den->Clone();
870 h1tmp->SetName(stmp);
871 h1tmp->SetTitle(stmp);
872 h1tmp->GetYaxis()->SetTitle("Efficiency");
873 h1tmp->Reset();
874 h1tmp->Divide(h1num, h1den, 1., 1., "B");
875 dir->cd();
876 h1tmp->Write();
877 h1tmpg = new TGraphAsymmErrors();
878 h1tmpg->SetName(stmpg);
879 h1tmpg->SetMarkerStyle(20);
880 h1tmpg->SetMinimum(0.0);
881 h1tmpg->SetMaximum(1.05);
882 h1tmpg->BayesDivide(h1num, h1den);
883 h1tmpg->GetYaxis()->SetTitle("Efficiency");
884 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
885 dir->cd();
886 h1tmpg->Write();
887 delete h1tmpg;
888 }
889 }
890
891 // for ES, L1 end ------------------------------------------------------------
892 sden = nd_dir + chainName + triggerES[ies] + "_Turn_On_Curve_wrt_MuidSA_Denominator";
893 snum = nd_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_Numerator";
894 seff = eff_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA";
895 seffg = seff + "_Fit"; // YY added 20.04.10
896 stmp = chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA";
897 stmpg = chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
898 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
899 if (!h1num) continue;
900
901 h1tmp = (TH1F*) h1den->Clone();
902 h1tmp->SetName(stmp);
903 h1tmp->SetTitle(stmp);
904 h1tmp->GetYaxis()->SetTitle("Efficiency");
905 h1tmp->Reset();
906 h1tmp->Divide(h1num, h1den, 1., 1., "B");
907 dir->cd();
908 h1tmp->Write();
909 h1tmpg = new TGraphAsymmErrors();
910 h1tmpg->SetName(stmpg);
911 h1tmpg->SetMarkerStyle(20);
912 h1tmpg->SetMinimum(0.0);
913 h1tmpg->SetMaximum(1.05);
914 h1tmpg->BayesDivide(h1num, h1den);
915 h1tmpg->GetYaxis()->SetTitle("Efficiency");
916 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
917 dir->cd();
918 h1tmpg->Write();
919 delete h1tmpg;
920
921 if (0 == alg || 2 == alg) {
922 if (ESTAG == ies || ESINDEP == ies) {
923 double sumeff, sumerr;
924 double sumn = h1num->Integral(iMSL, iMSH);
925 double sumd = h1den->Integral(iMSL, iMSH);
926 if (sumd == 0.) {
927 sumeff = 0.;
928 sumerr = 0.;
929 } else {
930 sumeff = (double) sumn / (double) sumd;
931 sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
932 }
933 int iholx = -1;
934 if (0 == alg) {
935 iholx = static_cast<int>(iL2MuonSA);
936 } else if (2 == alg) {
937 iholx = static_cast<int>(iEFSA);
938 }
939
940 if (iholx >= 0) {
941 TString s = eff_dir + chainName + "_highpt_effsummary_by" + triggerES[ies];
942 h1sumeff = getHPointer(s);
943 if (!h1sumeff) continue;
944 h1sumeff->GetYaxis()->SetTitleOffset(1.3);
945 h1sumeff->SetBinContent(iholx + 1, sumeff);
946 h1sumeff->SetBinError(iholx + 1, sumerr);
947 h1sumeff->SetMinimum(0.0);
948 h1sumeff->SetMaximum(1.05);
949 // saving
950 dir->cd();
951 h1sumeff->Write("", TObject::kOverwrite);
952 }
953 }
954 }
955 }
956 // for ES: end ----------------------------------------------------------------
957
958 if (0 == alg || 2 == alg) {
959 for (int be = 0; be < 2; be++) {
960 //wrt MuidSA
961 sden = nd_dir + chainName + "_Turn_On_Curve_wrt_MuidSA" + bestr[be] + "_Denominator";
962 snum = nd_dir + chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
963 seff = eff_dir + chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidSA";
964 seffg = seff + "_Fit"; // YY added 20.04.10
965 stmp = chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidSA";
966 stmpg = chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidSA" + "_Fit";
967 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
968 if (!h1num) continue;
969
970 h1tmp = (TH1F*) h1den->Clone();
971 h1tmp->SetName(stmp);
972 h1tmp->SetTitle(stmp);
973 h1tmp->GetYaxis()->SetTitle("Efficiency");
974 h1tmp->Reset();
975 h1tmp->Divide(h1num, h1den, 1., 1., "B");
976 dir->cd();
977 h1tmp->Write();
978 h1tmpg = new TGraphAsymmErrors();
979 h1tmpg->SetName(stmpg);
980 h1tmpg->SetMarkerStyle(20);
981 h1tmpg->SetMinimum(0.0);
982 h1tmpg->SetMaximum(1.05);
983 h1tmpg->BayesDivide(h1num, h1den);
984 h1tmpg->GetYaxis()->SetTitle("Efficiency");
985 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
986 dir->cd();
987 h1tmpg->Write();
988 delete h1tmpg;
989 }
990 }
991
992 //wrt upstream
993 sden = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + "_Denominator";
994 snum = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_Numerator";
995 seff = eff_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg];
996 seffg = seff + "_Fit"; // YY added 20.04.10
997 stmp = chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg];
998 stmpg = chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + "_Fit";
999 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1000 if (!h1num) continue;
1001
1002 h1tmp = (TH1F*) h1den->Clone();
1003 h1tmp->SetName(stmp);
1004 h1tmp->SetTitle(stmp);
1005 h1tmp->GetYaxis()->SetTitle("Efficiency");
1006 h1tmp->Reset();
1007 h1tmp->Divide(h1num, h1den, 1., 1., "B");
1008 dir->cd();
1009 h1tmp->Write();
1010 h1tmpg = new TGraphAsymmErrors();
1011 h1tmpg->SetName(stmpg);
1012 h1tmpg->SetMarkerStyle(20);
1013 h1tmpg->SetMinimum(0.0);
1014 h1tmpg->SetMaximum(1.05);
1015 h1tmpg->BayesDivide(h1num, h1den);
1016 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1017 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1018 dir->cd();
1019 h1tmpg->Write();
1020 delete h1tmpg;
1021
1022
1023 //wrt upstream
1024 // for ES --------------------------------------------------------------------
1025 for (int ies = 0; ies <= maxESbr; ies++) {
1026 if (!MS_mon_ESbr[ies]) continue;
1027 sden = nd_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] +
1028 "_Denominator";
1029 snum = nd_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_Numerator";
1030 seff = eff_dir + chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg];
1031 seffg = seff + "_Fit"; // YY added 20.04.10
1032 stmp = chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg];
1033 stmpg = chainName + triggerES[ies] + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + "_Fit";
1034 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1035 if (!h1num) continue;
1036
1037 h1tmp = (TH1F*) h1den->Clone();
1038 h1tmp->SetName(stmp);
1039 h1tmp->SetTitle(stmp);
1040 h1tmp->GetYaxis()->SetTitle("Efficiency");
1041 h1tmp->Reset();
1042 h1tmp->Divide(h1num, h1den, 1., 1., "B");
1043 dir->cd();
1044 h1tmp->Write();
1045 h1tmpg = new TGraphAsymmErrors();
1046 h1tmpg->SetName(stmpg);
1047 h1tmpg->SetMarkerStyle(20);
1048 h1tmpg->SetMinimum(0.0);
1049 h1tmpg->SetMaximum(1.05);
1050 h1tmpg->BayesDivide(h1num, h1den);
1051 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1052 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1053 dir->cd();
1054 h1tmpg->Write();
1055 delete h1tmpg;
1056 }
1057 // for ES: end --------------------------------------------------------------------
1058
1059 if (0 == alg || 2 == alg) {
1060 for (int be = 0; be < 2; be++) {
1061 //wrt upstream
1062 sden = nd_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + bestr[be] + "_Denominator";
1063 snum = nd_dir + chainName + alg2[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1064 seff = eff_dir + chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + bestr[be];
1065 seffg = seff + "_Fit"; // YY added 20.04.10
1066 stmp = chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + bestr[be];
1067 stmpg = chainName + alg2[alg] + "_Turn_On_Curve_wrt" + wrtalg2[alg] + bestr[be] + "_Fit";
1068 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1069 if (!h1num) continue;
1070
1071 h1tmp = (TH1F*) h1den->Clone();
1072 h1tmp->SetName(stmp);
1073 h1tmp->SetTitle(stmp);
1074 h1tmp->GetYaxis()->SetTitle("Efficiency");
1075 h1tmp->Reset();
1076 h1tmp->Divide(h1num, h1den, 1., 1., "B");
1077 dir->cd();
1078 h1tmp->Write();
1079 h1tmpg = new TGraphAsymmErrors();
1080 h1tmpg->SetName(stmpg);
1081 h1tmpg->SetMarkerStyle(20);
1082 h1tmpg->SetMinimum(0.0);
1083 h1tmpg->SetMaximum(1.05);
1084 h1tmpg->BayesDivide(h1num, h1den);
1085 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1086 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1087 dir->cd();
1088 h1tmpg->Write();
1089 delete h1tmpg;
1090 }
1091 }
1092 }//alg
1093 mf.Write();
1094 }//i
1095
1096 //==Rate
1097 dir = mf.GetDirectory(rr_dir);
1098 if (!dir) {
1099 if (fdbg) {
1100 std::cerr << "HLTMuonHistogramDivision: directory " << rr_dir << " not found" << std::endl;
1101 }
1102 return;
1103 }
1104
1105 // EF rate / offline rate
1106 std::string type[3] = {
1107 "MS_", "SA_", "CB_"
1108 };
1109 std::string off[3] = {
1110 "Moore_MS_", "Moore_SA_", "Muid_"
1111 };
1112 std::string cut[2] = {
1113 "4", "10"
1114 };
1115
1116 for (int itype = 0; itype < 3; itype++) {
1117 for (int icut = 0; icut < 2; icut++) {
1118 seff = rr_dir + "EF_" + type[itype] + "Over_" + off[itype] + cut[icut] + "GeV_Cut";
1119 snum = rate_dir + "Number_Of_EF_" + type[itype] + "Muons_" + cut[icut] + "GeV_Cut";
1120 sden = rate_dir + "Number_Of_" + off[itype] + "Muons_" + cut[icut] + "GeV_Cut";
1121 stmp = "EF_" + type[itype] + "Over_" + off[itype] + cut[icut] + "GeV_Cut";
1122 stmpg = "EF_" + type[itype] + "Over_" + off[itype] + cut[icut] + "GeV_Cut" + "_Fit";
1123 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1124 if (!h1num) continue;
1125
1126 h1tmp = (TH1F*) h1den->Clone();
1127 h1tmp->SetName(stmp);
1128 h1tmp->SetTitle(stmp);
1129 h1tmp->GetYaxis()->SetTitle("Efficiency");
1130 h1tmp->Reset();
1131 h1tmp->Divide(h1num, h1den, 1., 1., "B");
1132 dir->cd();
1133 h1tmp->Write();
1134 }//icut
1135 }//itype
1136 mf.Write();
1137
1138 // Triggers / Event
1139 std::vector<TString> chains;
1140 std::vector<TString> chains2;
1141
1142 {
1143 std::map<std::string, std::string> ztpmap;
1144
1145 ztpmap["muChain1"] = "L1_MU15";
1146 ztpmap["muChain2"] = "L1_MU15";
1147 ztpmap["muChainEFiso1"] = "L1_MU15";
1148 ztpmap["muChainEFiso2"] = "L1_MU15";
1149 ztpmap["muChainMSonly1"] = "L1_MU15";
1150 ztpmap["muChainMSonly2"] = "L1_MU15";
1151
1152 std::map<std::string, int> ztp_isomap;
1153 ztp_isomap["muChain1"] = 0;
1154 ztp_isomap["muChain2"] = 0;
1155 ztp_isomap["muChainEFiso1"] = 1;
1156 ztp_isomap["muChainEFiso2"] = 1;
1157 ztp_isomap["muChainMSonly1"] = 0;
1158 ztp_isomap["muChainMSonly2"] = 0;
1159
1160 for (std::map<std::string, std::string>::iterator itmap = ztpmap.begin(); itmap != ztpmap.end(); ++itmap) {
1161 TString histdirmuztp = run_dir + "/HLT/MuonMon/MuZTP/" + itmap->first;
1162 TDirectory* ztpdir = mf.GetDirectory(histdirmuztp);
1163 bool isefisochain = ztp_isomap[itmap->first] > 0;
1164
1165 //efficiency histograms
1166 std::vector<std::string> var;
1167 var.push_back("_Pt_");
1168 var.push_back("_Pt_EC_");
1169 var.push_back("_Pt_B_");
1170 var.push_back("_Pt_4bins_");
1171 var.push_back("_Pt_B_4bins_");
1172 var.push_back("_Eta_");
1173 var.push_back("_Phi_");
1174 var.push_back("_Phi_EC_");
1175 var.push_back("_Phi_B_");
1176 for (unsigned int k = 0; k < var.size(); k++) {
1177 std::vector<std::string> level;
1178 level.push_back("L1");
1179 level.push_back("L2");
1180 level.push_back("EF");
1181 if (isefisochain) level.push_back("EFIso");
1182 for (unsigned int j = 0; j < level.size(); j++) {
1183 //ABSOLUTE
1184 seffg = histdirmuztp + "/muZTP_eff_" + level[j] + var[k] + itmap->first;
1185 snum = histdirmuztp + "/muZTP" + var[k] + level[j] + "fired_" + itmap->first;
1186 sden = histdirmuztp + "/muZTP" + var[k] + itmap->first;
1187 stmp = "muZTP_eff_" + level[j] + var[k] + itmap->first;
1188 stmpg = "muZTP_eff_" + level[j] + var[k] + itmap->first;
1189 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1190 if (!h1num) continue;
1191
1192 h1tmpg = new TGraphAsymmErrors();
1193 h1tmpg->SetName(stmpg);
1194 h1tmpg->SetMarkerStyle(20);
1195 h1tmpg->SetMinimum(0.0);
1196 h1tmpg->SetMaximum(1.05);
1197 h1tmpg->BayesDivide(h1num, h1den);
1198 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1199 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1200 ztpdir->cd();
1201 h1tmpg->Write();
1202 delete h1tmpg;
1203 mf.Write();
1204
1205 seffg = histdirmuztp + "/muZTP_eff_" + level[j] + "_Eta_1bin_" + itmap->first;
1206 snum = histdirmuztp + "/muZTP_Eta_1bin_" + level[j] + "fired_" + itmap->first;
1207 sden = histdirmuztp + "/muZTP_Eta_1bin_" + itmap->first;
1208 stmpg = "muZTP_eff_" + level[j] + "_Eta_1bin_" + itmap->first;
1209 const auto & [h1num2, h1den2] = getHistogramPair(snum, sden);
1210 if (!h1num2) continue;
1211
1212 h1tmpg = new TGraphAsymmErrors();
1213 h1tmpg->SetName(stmpg);
1214 h1tmpg->SetMarkerStyle(20);
1215 h1tmpg->SetMinimum(0.0);
1216 h1tmpg->SetMaximum(1.05);
1217 h1tmpg->BayesDivide(h1num2, h1den2);
1218 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1219 h1tmpg->GetXaxis()->SetTitle(h1den2->GetXaxis()->GetTitle());
1220 ztpdir->cd();
1221 h1tmpg->Write();
1222 delete h1tmpg;
1223 mf.Write();
1224
1225 seffg = histdirmuztp + "/muZTP_eff_" + level[j] + "_Eta_2bins_" + itmap->first;
1226 snum = histdirmuztp + "/muZTP_Eta_2bins_" + level[j] + "fired_" + itmap->first;
1227 sden = histdirmuztp + "/muZTP_Eta_2bins_" + itmap->first;
1228 stmpg = "muZTP_eff_" + level[j] + "_Eta_2bins_" + itmap->first;
1229 const auto & [h1num3, h1den3] = getHistogramPair(snum, sden);
1230
1231 //h1num = getHPointer(snum);
1232 if (!h1num3) continue;
1233 //h1den = getHPointer(sden);
1234 //if (!h1den) continue;
1235
1236 h1tmpg = new TGraphAsymmErrors();
1237 h1tmpg->SetName(stmp);
1238 h1tmpg->SetMarkerStyle(20);
1239 h1tmpg->SetMinimum(0.0);
1240 h1tmpg->SetMaximum(1.05);
1241 h1tmpg->BayesDivide(h1num3, h1den3);
1242 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1243 h1tmpg->GetXaxis()->SetTitle(h1den3->GetXaxis()->GetTitle());
1244 ztpdir->cd();
1245 h1tmpg->Write();
1246 delete h1tmpg;
1247 mf.Write();
1248
1249 seffg = histdirmuztp + "/muZTP_eff_" + level[j] + "_Eta_1bin_cut_" + itmap->first;
1250 snum = histdirmuztp + "/muZTP_Eta_1bin_cut_" + level[j] + "fired_" + itmap->first;
1251 sden = histdirmuztp + "/muZTP_Eta_1bin_cut_" + itmap->first;
1252 stmpg = "muZTP_eff_" + level[j] + "_Eta_1bin_cut_" + itmap->first;
1253 const auto & [h1num4, h1den4] = getHistogramPair(snum, sden);
1254 if (!h1num4) continue;
1255
1256 h1tmpg = new TGraphAsymmErrors();
1257 h1tmpg->SetName(stmpg);
1258 h1tmpg->SetMarkerStyle(20);
1259 h1tmpg->SetMinimum(0.0);
1260 h1tmpg->SetMaximum(1.05);
1261 h1tmpg->BayesDivide(h1num4, h1den4);
1262 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1263 h1tmpg->GetXaxis()->SetTitle(h1den4->GetXaxis()->GetTitle());
1264 ztpdir->cd();
1265 h1tmpg->Write();
1266 delete h1tmpg;
1267 mf.Write();
1268
1269 seffg = histdirmuztp + "/muZTP_eff_" + level[j] + "_Eta_2bins_cut_" + itmap->first;
1270 snum = histdirmuztp + "/muZTP_Eta_2bins_cut_" + level[j] + "fired_" + itmap->first;
1271 sden = histdirmuztp + "/muZTP_Eta_2bins_cut_" + itmap->first;
1272 stmpg = "muZTP_eff_" + level[j] + "_Eta_2bins_cut_" + itmap->first;
1273 const auto & [h1num5, h1den5] = getHistogramPair(snum, sden);
1274 if (!h1num5) continue;
1275
1276 h1tmpg = new TGraphAsymmErrors();
1277 h1tmpg->SetName(stmpg);
1278 h1tmpg->SetMarkerStyle(20);
1279 h1tmpg->SetMinimum(0.0);
1280 h1tmpg->SetMaximum(1.05);
1281 h1tmpg->BayesDivide(h1num5, h1den5);
1282 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1283 h1tmpg->GetXaxis()->SetTitle(h1den5->GetXaxis()->GetTitle());
1284 ztpdir->cd();
1285 h1tmpg->Write();
1286 delete h1tmpg;
1287 mf.Write();
1288
1289 //2D ETA_PHI
1290 seff = histdirmuztp + "/muZTP_eff_EtaPhi_" + level[j] + "_" + itmap->first;
1291 snum = histdirmuztp + "/muZTP_EtaPhi_" + level[j] + "_" + itmap->first;
1292 sden = histdirmuztp + "/muZTP_EtaPhi_all_" + itmap->first;
1293 stmp = "muZTP_eff_EtaPhi_" + level[j] + "_" + itmap->first;
1294
1295 TH2F* h2num(0);
1296 TH2F* h2den(0);
1297 TH2F* h2tmp(0);
1298
1299 h2num = getH2Pointer(snum);
1300 if (!h2num) continue;
1301 h2den = getH2Pointer(sden);
1302 if (!h2den) continue;
1303
1304 h2tmp = (TH2F*) h1den->Clone();
1305 h2tmp->SetName(stmp);
1306 h2tmp->SetTitle(stmp);
1307 h2tmp->GetYaxis()->SetTitle("Efficiency");
1308 h2tmp->Reset();
1309 h2tmp->Divide(h1num, h1den, 1., 1., "B");
1310 dir->cd();
1311 h2tmp->Write();
1312 mf.Write();
1313 }//level
1314
1315 //RELATIVE
1316 seffg = histdirmuztp + "/muZTP_eff_EFwrtL2" + var[k] + itmap->first;
1317 snum = histdirmuztp + "/muZTP" + var[k] + "EFL2fired_" + itmap->first;
1318 sden = histdirmuztp + "/muZTP" + var[k] + "L2fired_" + itmap->first;
1319 stmpg = "muZTP_eff_EFwrtL2" + var[k] + itmap->first;
1320 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1321 if (!h1num) continue;
1322
1323 h1tmpg = new TGraphAsymmErrors();
1324 h1tmpg->SetName(stmpg);
1325 h1tmpg->SetMarkerStyle(20);
1326 h1tmpg->SetMinimum(0.0);
1327 h1tmpg->SetMaximum(1.05);
1328 h1tmpg->BayesDivide(h1num, h1den);
1329 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1330 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1331 ztpdir->cd();
1332 h1tmpg->Write();
1333 delete h1tmpg;
1334 mf.Write();
1335
1336 seffg = histdirmuztp + "/muZTP_eff_EFwrtL1" + var[k] + itmap->first;
1337 snum = histdirmuztp + "/muZTP" + var[k] + "EFfired_" + itmap->first;
1338 sden = histdirmuztp + "/muZTP" + var[k] + "L1fired_" + itmap->first;
1339 stmpg = "muZTP_eff_EFwrtL1" + var[k] + itmap->first;
1340 const auto & [h1num2, h1den2] = getHistogramPair(snum, sden);
1341 if (!h1num2) continue;
1342
1343 h1tmpg = new TGraphAsymmErrors();
1344 h1tmpg->SetName(stmpg);
1345 h1tmpg->SetMarkerStyle(20);
1346 h1tmpg->SetMinimum(0.0);
1347 h1tmpg->SetMaximum(1.05);
1348 h1tmpg->BayesDivide(h1num2, h1den2);
1349 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1350 h1tmpg->GetXaxis()->SetTitle(h1den2->GetXaxis()->GetTitle());
1351 ztpdir->cd();
1352 h1tmpg->Write();
1353 delete h1tmpg;
1354 mf.Write();
1355
1356 seffg = histdirmuztp + "/muZTP_eff_L2wrtL1" + var[k] + itmap->first;
1357 snum = histdirmuztp + "/muZTP" + var[k] + "L2fired_" + itmap->first;
1358 sden = histdirmuztp + "/muZTP" + var[k] + "L1fired_" + itmap->first;
1359 stmpg = "muZTP_eff_L2wrtL1" + var[k] + itmap->first;
1360 const auto & [h1num3, h1den3] = getHistogramPair(snum, sden);
1361 if (!h1num3) continue;
1362
1363 h1tmpg = new TGraphAsymmErrors();
1364 h1tmpg->SetName(stmpg);
1365 h1tmpg->SetMarkerStyle(20);
1366 h1tmpg->SetMinimum(0.0);
1367 h1tmpg->SetMaximum(1.05);
1368 h1tmpg->BayesDivide(h1num3, h1den3);
1369 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1370 h1tmpg->GetXaxis()->SetTitle(h1den3->GetXaxis()->GetTitle());
1371 ztpdir->cd();
1372 h1tmpg->Write();
1373 delete h1tmpg;
1374 mf.Write();
1375
1376 if (isefisochain) {
1377 seffg = histdirmuztp + "/muZTP_eff_EFIsowrtEF" + var[k] + itmap->first;
1378 snum = histdirmuztp + "/muZTP" + var[k] + "EFIsofired_" + itmap->first;
1379 sden = histdirmuztp + "/muZTP" + var[k] + "EFfired_" + itmap->first;
1380 stmpg = "muZTP_eff_EFIsowrtEF" + var[k] + itmap->first;
1381 const auto & [h1num, h1den] = getHistogramPair(snum, sden);
1382 if (!h1num) continue;
1383
1384 h1tmpg = new TGraphAsymmErrors();
1385 h1tmpg->SetName(stmpg);
1386 h1tmpg->SetMarkerStyle(20);
1387 h1tmpg->SetMinimum(0.0);
1388 h1tmpg->SetMaximum(1.05);
1389 h1tmpg->BayesDivide(h1num, h1den);
1390 h1tmpg->GetYaxis()->SetTitle("Efficiency");
1391 h1tmpg->GetXaxis()->SetTitle(h1den->GetXaxis()->GetTitle());
1392 ztpdir->cd();
1393 h1tmpg->Write();
1394 delete h1tmpg;
1395 mf.Write();
1396 }
1397 }//var
1398 }
1399 // mf.Write();
1400 } // procMuZTP
1401
1402
1403 {
1404 TDirectory* efdir = mf.GetDirectory(eff_dir);
1405 if (!efdir) {
1406 if (fdbg) {
1407 std::cerr << "HLTMuonHistogramDivision: directory " << eff_dir << " not found" << std::endl;
1408 }
1409 return;
1410 }
1411
1412 // MAM
1413 const int MAXARR = 6;
1414 std::string charr[MAXARR] = {
1415 "muChain1", "muChain2", "muChainEFiso1", "muChainEFiso2", "muChainMSonly1", "muChainMSonly2"
1416 };
1417 std::string monarr[MAXARR] = {
1418 "_EFmuon", "_EFmuon", "_EFmuon", "_EFmuon", "_MuonEFSA", "_MuonEFSA"
1419 };
1420 std::string monL2arr[MAXARR] = {
1421 "_L2MuonSA", "_L2MuonSA", "_L2MuonSA", "_L2MuonSA", "_L2MuonSA", "_L2MuonSA"
1422 };
1423 bool isBarrelMon[MAXARR] = {
1424 false, false, false, false, true, true
1425 }; // enable MSonly
1426 bool isMSbMon[MAXARR] = {
1427 true, true, false, false, false, false
1428 }; // Skip isol and MSonly
1429 bool monL1[MAXARR] = {
1430 true, true, true, true, false, false
1431 }; // Skip MSonly
1432 bool isefIsolation[MAXARR] = {
1433 false, false, true, true, false, false
1434 }; // EF isolation add by Yuan
1435
1436 // I need to prepare maps ... mu20_MG -> MuGirlEF etc.
1437 for (int ialg = 0; ialg < MAXARR; ialg++) {
1438 std::string chainName = charr[ialg];
1439 std::string MoniAlg = monarr[ialg];
1440 std::string MoniL2Alg = monL2arr[ialg];
1441
1442 /* 1. Picking up ztp graph */
1443 TString hdirztp = muon_dir + "MuZTP/" + chainName + "/";
1444 TString histZtpNum, histZtpDen;
1445 if (!isBarrelMon[ialg]) {
1446 histZtpNum = hdirztp + "muZTP_Pt_4bins_EFfired_" + chainName;
1447 histZtpDen = hdirztp + "muZTP_Pt_4bins_L1fired_" + chainName;
1448 } else {
1449 histZtpNum = hdirztp + "muZTP_Pt_B_4bins_EFfired_" + chainName;
1450 histZtpDen = hdirztp + "muZTP_Pt_B_4bins_L1fired_" + chainName;
1451 }
1452 if (isefIsolation[ialg]) histZtpNum = hdirztp + "muZTP_Pt_4bins_EFIsofired_" + chainName; // add by Yuan
1453 TString histZtpEff = eff_dir + chainName + "_highpt3bins_effwrtL1";
1454 const auto & [h1num, h1den] = getHistogramPair(histZtpNum, histZtpDen);
1455 if (!h1num) continue;
1456 h1eff = getHPointer(histZtpEff);
1457 if (!h1eff) continue;
1458
1459 /* 2. Filling summary histogram from ZTP values */
1460 for (int ibin = 2; ibin <= 3; ibin++) {
1461 // at the moment it is not correct if we run the algorithm # 4: mu40_MSonly_barrel .
1462 double sumeff {}, sumerr {};
1463 double sumn = h1num->Integral(ibin, ibin);
1464 if (isBarrelMon[ialg] || isMSbMon[ialg]) sumn = h1num->Integral(ibin + 1, ibin + 1);
1465 double sumd = h1den->Integral(ibin, ibin);
1466 if (isBarrelMon[ialg] || isMSbMon[ialg]) sumd = h1den->Integral(ibin + 1, ibin + 1);
1467 if (sumd != 0.) {
1468 sumeff = (double) sumn / (double) sumd;
1469 sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1470 }
1471 h1eff->GetYaxis()->SetTitle("Efficiency");
1472 h1eff->SetBinContent(ibin - 1, sumeff);
1473 h1eff->SetBinError(ibin - 1, sumerr);
1474 h1eff->SetMinimum(0.0);
1475 h1eff->SetMaximum(1.05);
1476 }
1477
1478
1479
1480 efdir->cd();
1481 h1eff->Write("", TObject::kOverwrite);
1482
1483 if (monL1[ialg]) { // MUST skip muGirl, muIso and MSonly as histograms are not defined!!!
1484 TString hdirztp = muon_dir + "MuZTP/" + chainName + "/";
1485 TString histZtpNumB = hdirztp + "muZTP_Pt_B_L1fired_" + chainName;
1486 TString histZtpDenB = hdirztp + "muZTP_Pt_B_" + chainName;
1487 TString histZtpNumE = hdirztp + "muZTP_Pt_EC_L1fired_" + chainName;
1488 TString histZtpDenE = hdirztp + "muZTP_Pt_EC_" + chainName;
1489 TString histZtpL1sum = eff_dir + chainName + "_highptL1plateau_wrtOffline";
1490
1491 TH1F* h1numb = getHPointer(histZtpNumB);
1492 if (!h1numb) continue;
1493 TH1F* h1nume = getHPointer(histZtpNumE);
1494 if (!h1nume) continue;
1495 TH1F* h1denb = getHPointer(histZtpDenB);
1496 if (!h1denb) continue;
1497 TH1F* h1dene = getHPointer(histZtpDenE);
1498 if (!h1dene) continue;
1499 TH1F* h1sumL = getHPointer(histZtpL1sum);
1500 if (!h1sumL) continue;
1501
1502 double sumeff, sumerr;
1503 double sumn = h1numb->Integral(13, 25); // 12-25 GeV
1504 if (HI_pp_key) sumn = h1numb->Integral(13, 20); // 60-100 GeV
1505 double sumd = h1denb->Integral(13, 25);
1506 if (HI_pp_key) sumd = h1denb->Integral(13, 20);
1507 if (sumd == 0.) {
1508 sumeff = 0.;
1509 sumerr = 0.;
1510 } else {
1511 sumeff = (double) sumn / (double) sumd;
1512 sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1513 }
1514 h1sumL->SetBinContent(1, sumeff);
1515 h1sumL->SetBinError(1, sumerr);
1516
1517 sumn = h1nume->Integral(13, 25);
1518 if (HI_pp_key) sumn = h1numb->Integral(13, 20); // 60-100 GeV
1519 sumd = h1dene->Integral(13, 25);
1520 if (HI_pp_key) sumd = h1denb->Integral(13, 20);
1521 if (sumd == 0.) {
1522 sumeff = 0.;
1523 sumerr = 0.;
1524 } else {
1525 sumeff = (double) sumn / (double) sumd;
1526 sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1527 }
1528 h1sumL->GetYaxis()->SetTitle("Efficiency");
1529 h1sumL->SetBinContent(2, sumeff);
1530 h1sumL->SetBinError(2, sumerr);
1531 h1sumL->SetMinimum(0.0);
1532 h1sumL->SetMaximum(1.05);
1533 efdir->cd();
1534 h1sumL->Write("", TObject::kOverwrite);
1535 }
1536 }
1537 mf.Write();
1538 } //procChainDQA_HighPt
1539 //===End HLTMuonw
1540
1541 // ******************************************************//
1542 // ********************* generic ***********************//
1543 // ******************************************************//
1544 TString monalg[3] = {
1545 "_L2MuonSA", "_MuComb", "_EFmuon"
1546 };
1547 TString wrtalg[3] = {
1548 "_L1", "_L2MuonSA", "_MuComb"
1549 };
1550 TString numer, denom, effi;
1551 TString histdireff = eff_dir;
1552
1553 TDirectory* efdir = mf.GetDirectory(eff_dir);
1554 if (!efdir) {
1555 if (fdbg) {
1556 std::cerr << "HLTMuonHistogramDivision: directory " << eff_dir << " not found" << std::endl;
1557 }
1558 return;
1559 }
1560
1561 // processing Iso histograms in the same manner
1562 chainsGeneric.insert(chainsGeneric.end(), chainsEFiso.begin(), chainsEFiso.end());
1563
1564 for (unsigned int i = 0; i < chainsGeneric.size(); i++) {
1565 TString chainName = chainsGeneric.at(i);
1566 if (fdbg) {
1567 std::cout << "proc generic " << chainName << std::endl;
1568 }
1569
1570 //wrt CB muon && Upstream trigger
1571 for (int alg = 0; alg < 3; alg++) {
1572 denom = chainName + "_Turn_On_Curve_wrt_MuidCB_Denominator";
1573 numer = chainName + monalg[alg] + "_Turn_On_Curve_Numerator";
1574 effi = chainName + monalg[alg] + "_Turn_On_Curve_wrt_MuidCB";
1575 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1576
1577 denom = chainName + MSchainName + "_Turn_On_Curve_wrt_MuidCB_Denominator";
1578 numer = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_Numerator";
1579 effi = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt_MuidCB";
1580 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1581
1582 // Summary all - removed
1583
1584 denom = chainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + "_Denominator";
1585 numer = chainName + monalg[alg] + "_Turn_On_Curve_Numerator";
1586 effi = chainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg];
1587 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1588
1589
1590 denom = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + "_Denominator";
1591 numer = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_Numerator";
1592 effi = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg];
1593 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1594
1595 // for ES ------------------------------------------------------------------------------------
1596 for (int i = 0; i <= maxESbr; i++) {
1597 if (!CB_mon_ESbr[i]) continue;
1598 if (0 == alg) {
1599 // L1 efficiency: new for 2011 HI runs and afterward
1600 // only division once since it is "the zero-th" algorithm
1601 denom = chainName + triggerES[i] + "_Turn_On_Curve_wrt_MuidCB_Denominator";
1602 numer = chainName + triggerES[i] + "_L2MuonSA" + "_Turn_On_Curve_wrt" + "_L1" + "_Denominator";
1603 effi = chainName + triggerES[i] + "_L1" + "_Turn_On_Curve_wrt_MuidCB";
1604 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1605
1606 // Need to implement barrel and endcap ...
1607 for (int be = 0; be < 2; be++) {
1608 denom = chainName + triggerES[i] + "_Turn_On_Curve_wrt_MuidCB" + bestr[be] + "_Denominator";
1609 numer = chainName + triggerES[i] + "_L2MuonSA" + "_Turn_On_Curve_wrt" + "_L1" + bestr[be] +
1610 "_Denominator";
1611 effi = chainName + triggerES[i] + "_L1" + bestr[be] + "_Turn_On_Curve_wrt_MuidCB";
1612 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1613 const auto & [h1num, h1den] = getHistogramPair(nd_dir + numer, nd_dir + denom);
1614 if (!h1num) continue;
1615
1616 if (ESINDEP == i) {
1617 // integrating over and fill in a summary histogram
1618 double sumeff {}, sumerr {};
1619 double sumn = h1num->Integral(iSTDL, iSTDH); // 60-100 GeV
1620 double sumd = h1den->Integral(iSTDL, iSTDH);
1621
1622 if (sumd != 0.) {
1623 sumeff = (double) sumn / (double) sumd;
1624 sumerr = sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1625 }
1626
1627 TString s = histdireff + chainName + "_L1plateau_wrtOffline_by_ESindep";
1628 TH1F* h1effL1 = getHPointer(s);
1629 if (!h1effL1) continue;
1630 h1effL1->SetBinContent(be + 1, sumeff);
1631 h1effL1->SetBinError(be + 1, sumerr);
1632 h1eff->SetMinimum(0.0);
1633 h1eff->SetMaximum(1.05);
1634 efdir->cd();
1635 h1effL1->Write("", TObject::kOverwrite);
1636 }
1637 }
1638 }
1639
1640 denom = chainName + triggerES[i] + "_Turn_On_Curve_wrt_MuidCB_Denominator";
1641 numer = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_Numerator";
1642 effi = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_wrt_MuidCB";
1643 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1644 const auto & [h1num, h1den] = getHistogramPair(nd_dir + numer, nd_dir + denom);
1645
1646 // Summary ESid and ESindep
1647
1648 if (!h1num) continue;
1649 if (0 == alg || 1 == alg || 2 == alg) {
1650 double sumd {}, sumn {}, sumeff {}, sumerr {};
1651 sumn = h1num->Integral(iSTDL, iSTDH);
1652 sumd = h1den->Integral(iSTDL, iSTDH);
1653
1654 if (sumd != 0.) {
1655 sumeff = (double) sumn / (double) sumd;
1656 sumerr = std::sqrt((double) sumn * (1. - sumeff)) / (double) sumd;
1657 }
1658 int iholx = -1;
1659 if (0 == alg) {
1660 iholx = static_cast<int>(iL2MuonSA);
1661 } else if (1 == alg) {
1662 iholx = static_cast<int>(iMuComb);
1663 } else if (2 == alg) {
1664 iholx = static_cast<int>(iEFCB);
1665 }
1666
1667 TString s = histdireff + chainName + "_highpt_effsummary_by" + triggerES[i];
1668 h1effsum = getHPointer(s);
1669 if (!h1effsum) continue;
1670 //
1671 h1effsum->GetYaxis()->SetTitleOffset(1.3);
1672 h1effsum->SetBinContent(iholx + 1, sumeff);
1673 h1effsum->SetBinError(iholx + 1, sumerr);
1674 h1effsum->SetMinimum(0.0);
1675 h1effsum->SetMaximum(1.05);
1676 efdir->cd();
1677 h1effsum->Write("", TObject::kOverwrite);
1678 }
1679
1680 denom = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + "_Denominator";
1681 numer = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_Numerator";
1682 effi = chainName + triggerES[i] + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg];
1683 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1684 }
1685 // for ES : END ------------------------------------------------------------------------------
1686
1687 // Barrel/Endcap
1688 if (0 == alg || 1 == alg || 2 == alg) {
1689 for (int be = 0; be < 2; be++) {
1690 denom = chainName + "_Turn_On_Curve_wrt_MuidCB" + bestr[be] + "_Denominator";
1691 numer = chainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1692 effi = chainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidCB";
1693 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1694 }
1695
1696 for (int be = 0; be < 2; be++) {
1697 denom = chainName + MSchainName + "_Turn_On_Curve_wrt_MuidCB" + bestr[be] + "_Denominator";
1698 numer = chainName + MSchainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1699 effi = chainName + MSchainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_wrt_MuidCB";
1700 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1701 }
1702
1703 for (int be = 0; be < 2; be++) {
1704 denom = chainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + bestr[be] + "_Denominator";
1705 numer = chainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1706 effi = chainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + bestr[be];
1707 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1708 }
1709
1710
1711 for (int be = 0; be < 2; be++) {
1712 denom = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + bestr[be] +
1713 "_Denominator";
1714 numer = chainName + MSchainName + monalg[alg] + bestr[be] + "_Turn_On_Curve_Numerator";
1715 effi = chainName + MSchainName + monalg[alg] + "_Turn_On_Curve_wrt" + wrtalg[alg] + bestr[be];
1716 HLTMuonHDiv(mf, histdireff, numer, denom, effi, "_Fit");
1717 }
1718 }
1719 }
1720 }
1721 }//while (now just open bracket: 110728
1722 }//MonitoringFile::HLTMuonHistogramDivision
static void HLTMuonHDiv(PostProcessorFileWrapper &mf, TString sdir, TString snum, TString sden, TString seff, TString seffg)
cut
This script demonstrates how to call a C++ class from Python Also how to use PyROOT is shown.

◆ 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
static void HLTMuonHistogramDivision(const std::string &inFilename, TString &run_dir)
static void HLTMuonTriggerOverlapMatrix(const std::string &inFilename, TString &run_dir)

◆ 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 }
static void HLTTauPostProcess(const std::string &inFilename, bool isIncremental=false)

◆ 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 for (unsigned int iVar = 0; iVar < varN.size(); iVar++) {
191 for (unsigned int iRatio = 0; iRatio < ratioIndex.size(); iRatio++) {
192 TString hName;
193 if (nameStyle == 1)
194 hName = basePath + "h" +
195 lvlN[ ratioIndex[ iRatio ].first ] + "vs" + lvlN[ ratioIndex[ iRatio ].second ] +
196 varN[iVar] + "Efficiency" + nameApp;
197
198 if (nameStyle == 2)
199 hName = basePath + "h" +
200 lvlN[ ratioIndex[ iRatio ].first ] + "OfflineRatio" +
201 varN[iVar] + nameApp;
202
203 if (!CheckHistogram(f, hName.Data())) return;
204
205 TH1F* hEff = (TH1F*) (f->Get(hName.Data()));
206 hEff->Divide(hRoI[ ratioIndex[ iRatio ].first ][iVar],
207 hRoI[ ratioIndex[ iRatio ].second ][iVar],
208 1.0, 1.0, "b");
209
210 hEff->Write("", TObject::kOverwrite);
211 }
212 }
213
214 f->Write();
215 }

◆ 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 {
30 //bool debug = L1CALOPOSTPROCESSDEBUG;
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 }
static void L1CaloResetEfficiencies(TFile *f, const TString &effDir, const TString &nameDen, const TString &nameEff, int items, double threshold, int binSkip)
static void L1CaloStabilityRMS(TFile *f, const TString &nameDir, const TString &nameTag)

◆ 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 }
263 std::vector<TH1*>::iterator iter;
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 }
static void L1CaloFillWithError(TFile *f, const TString &nameDir, const TString &nameData, const TString &nameError)

◆ loopOnHistograms()

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

◆ loopOnHistogramsInMetadata()

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 }
static int IterativeGaussFit(TH1 *hist, double &mu, double &mu_err, double &sigma, double &sigma_err)
output
Definition merge.py:16

◆ 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 }
str index
Definition DeMoScan.py:362

◆ 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) {
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) {
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 }
static Double_t ss

◆ 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 }
static void MDTvsTGCEfficiency(const std::string &inFilename)

◆ 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 }
#define min(a, b)
Definition cfImp.cxx:40

◆ 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 75 of file MonitoringFile_MergeAlgs.cxx.

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

◆ merge_effAsPerCentAlt()

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

Definition at line 226 of file MonitoringFile_MergeAlgs.cxx.

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

◆ merge_eventSample()

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

Definition at line 550 of file MonitoringFile_MergeAlgs.cxx.

551{
552 // Author: Peter Faulkner
553 // Merge histograms containing, for example, event numbers of events
554 // with particular types of errors. Data is inserted/appended row-wise.
555 int nbinsx = a.GetNbinsX();
556 int nbinsy = a.GetNbinsY();
557 if (b.GetNbinsX() != nbinsx || b.GetNbinsY() != nbinsy) return;
558 double entries = a.GetEntries();
559 for( int biny = 1; biny <= nbinsy; biny++ ) {
560 for( int binx = 1; binx <= nbinsx; binx++ ) {
561 double bVal = b.GetBinContent(binx, biny);
562 if (bVal == 0) break;
563 for( int binxa = 1; binxa <= nbinsx; binxa++ ) {
564 double aVal = a.GetBinContent(binxa, biny);
565 if (aVal == 0) {
566 a.SetBinContent(binxa, biny, bVal);
567 entries++;
568 break;
569 } else if (bVal < aVal) {
570 for( int bx = nbinsx; bx > binxa; bx-- ) {
571 double v1 = a.GetBinContent(bx-1, biny);
572 if (v1 == 0) continue;
573 double v2 = a.GetBinContent(bx, biny);
574 if (v2 == 0) entries++;
575 a.SetBinContent(bx, biny, v1);
576 }
577 a.SetBinContent(binxa, biny, bVal);
578 break;
579 } else if (aVal == bVal) break;
580 }
581 }
582 }
583 a.SetEntries(entries);
584}
double entries
Definition listroot.cxx:49

◆ merge_identical()

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

Definition at line 752 of file MonitoringFile_MergeAlgs.cxx.

752 {
753
754 // Merge "status" histograms, i.e filled at start of run/LB.
755 // The histogram title should contain the LB for which the histo was filled
756 // such that strcmp can extract the histo of lower LB
757 // Be careful to not format your title with %d but rather %4d. Otherwise,
758 // strcmp will return : 2>10
759 // Example in : LArCalorimeter/LArMonTools/src/LArCoverage.cxx
760 // Author: B.Trocme
761 //
762
763 if (a.GetDimension() != b.GetDimension()) {
764 std::cerr<<"merge_identical \"" << a.GetName() <<"\": attempt to merge histograms of different dimensionality\n";
765 return;
766 }
767
768 Int_t ncells = getNumBins(a);
769
770 if (ncells != getNumBins(b)) {
771 std::cerr<<"merge_identical \"" << a.GetName() <<"\": attempt to merge histograms of different sizes\n";
772 return;
773 }
774
775 // check that all bins contentsl are identical
776 for (Int_t icell = 0; icell < ncells; ++icell) {
777 if ((a.GetBinContent(icell) != b.GetBinContent(icell))
778 || (a.GetBinError(icell) != b.GetBinError(icell))) {
779 std::cerr<<"merge_identical \"" << a.GetName() << "\" and \"" << b.GetName() << "\" have different content\n";
780 return;
781 }
782 }
783
784 return;
785}

◆ merge_lowerLB()

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

Definition at line 703 of file MonitoringFile_MergeAlgs.cxx.

703 {
704
705 // Merge "status" histograms, i.e filled at start of run/LB.
706 // The histogram title should contain the LB for which the histo was filled
707 // such that strcmp can extract the histo of lower LB
708 // Be careful to not format your title with %d but rather %4d. Otherwise,
709 // strcmp will return : 2>10
710 // Example in : LArCalorimeter/LArMonTools/src/LArCoverage.cxx
711 // Author: B.Trocme
712 //
713
714 if (a.GetDimension() != b.GetDimension()) {
715 std::cerr<<"merge_lowerLB \"" << a.GetName() <<"\": attempt to merge histograms of different dimensionality\n";
716 return;
717 }
718
719 Int_t ncells = getNumBins(a);
720
721 if (ncells != getNumBins(b)) {
722 std::cerr<<"merge_lowerLB \"" << a.GetName() <<"\": attempt to merge histograms of different sizes\n";
723 return;
724 }
725
726 // do not attempt to automatically extend!
727 a.SetCanExtend(TH1::kNoAxis);
728
729 if (strcmp(a.GetTitle(),b.GetTitle())>0){
730 // The LB of histo a is greater than the LB of histo b
731 // a is overwritten by b - Otherwise do nothing
732 a.SetTitle(b.GetTitle());
733 /*
734 for( int bin = 0; bin < ncells; bin++ ) {
735 a.SetBinContent(bin,b.GetBinContent(bin));
736 a.SetBinError(bin,b.GetBinError(bin));
737 }
738 */
739 a.Add(&a, &b, 0, 1);
740 // If the original histo did not contain sumw2, delete the sumw2 array created
741 // by SetBinError. This may look dirty but this is the recommandation by R.Brun:
742 // http://root.cern.ch/phpBB3/viewtopic.php?f=3&t=1620&p=51674&hilit=sumw2#p51674
743 /*
744 if ((b.GetSumw2N()) == 0) (a.GetSumw2())->Set(0);
745
746 a.SetEntries(b.GetEntries()); */
747 }
748 return;
749}

◆ merge_perBinEffPerCent()

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

Definition at line 135 of file MonitoringFile_MergeAlgs.cxx.

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

◆ merge_Rebinned()

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

Definition at line 501 of file MonitoringFile_MergeAlgs.cxx.

502{
503 // Author: Luca Fiorini
504 // This method provide a correct summation for histograms that have different binning
505 // e.g. the histograms with TH1::kCanRebin set to true
506 // The method uses TH1::Merge as explained here:
507 // http://root.cern.ch/root/html/TH1.html#TH1:Merge
508 // The axis x may have different number
509 // of bins and different limits, BUT the largest bin width must be
510 // a multiple of the smallest bin width and the upper limit must also
511 // be a multiple of the bin width.
512
513 // if the axes were all extendable, try to match the number of bins between the histograms
514 // this is only needed for TProfile2D ...
515 if(a.InheritsFrom("TProfile2D") && b.InheritsFrom("TProfile2D") && a.GetDimension()==b.GetDimension()) {
516 auto binsFunc = [](TH1& h, int ax) {
517 if(ax==0) return h.GetNbinsX();
518 if(ax==1) return h.GetNbinsY();
519 if(ax==2) return h.GetNbinsZ();
520 return 0;
521 };
522 for(int i=0;i<a.GetDimension();i++) {
523 int n1 = binsFunc(a,i);
524 int n2 = binsFunc(b,i);
525 if ((n1 == 0) or (n2 == 0)) {
526 throw std::runtime_error("MonitoringFile::merge_Rebinned; nbins is zero.");
527 }
528 if((n2 % n1 == 0) && std::bitset<sizeof(int)>(n2/n1).count()==1) { //n2 is a 2^N times bigger than n1
529 while(binsFunc(a,i) != binsFunc(b,i)) {
530 a.LabelsInflate((i==0) ? "x" : ( (i==1) ? "y" : "z"));
531 }
532 } else if((n1 % n2 == 0) && std::bitset<sizeof(int)>(n1/n2).count()==1) { //n1 is a 2^N times bigger than n2
533 while(binsFunc(a,i) != binsFunc(b,i)) {
534 b.LabelsInflate((i==0) ? "x" : ( (i==1) ? "y" : "z"));
535 }
536 }
537 }
538 }
539
540
541 TList *list = new TList;
542 list->Add(&b);
543 a.Merge(list);
544
545 delete list;
546
547}
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
list(name, path='/')
Definition histSizes.py:38

◆ merge_RMS()

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

Definition at line 586 of file MonitoringFile_MergeAlgs.cxx.

586 {
587
588 //Merge histograms where bins are filled with RMS type data:
589 // Add in quadrature, weighted by the number of events as
590 // reconstructed from the errors.
591
592 // Author: Evan Wulf
593
594 if (a.GetDimension() != b.GetDimension()) {
595 std::cerr<<"merge_RMS \""<< a.GetName() <<"\": attempt to merge histograms of different dimensionality\n";
596 return;
597 }
598
599 Int_t ncells = getNumBins(a);
600
601 if (ncells != getNumBins(b)) {
602 std::cerr<<"merge_RMS \""<< a.GetName() <<"\": attempt to merge histograms of different sizes\n";
603 return;
604 }
605
606 // do not attempt to automatically extend!
607 a.SetCanExtend(TH1::kNoAxis);
608
609 double nEntries = a.GetEntries();
610 nEntries += b.GetEntries();
611
612 for( int bin = 0; bin < ncells; bin++ ) {
613 double rms1 = a.GetBinContent(bin);
614 double rms2 = b.GetBinContent(bin);
615 double e1 = a.GetBinError(bin);
616 double e2 = b.GetBinError(bin);
617
618 double n1 = 0;
619 double n2 = 0;
620
621 if( e1 != 0 ) {
622 n1 = std::pow( rms1 / e1, 2) / 2;
623 }
624 if( e2 != 0 ) {
625 n2 = std::pow( rms2 / e2, 2) / 2;
626 }
627
628 double ntot = n1 + n2;
629 if( ntot <= 0 ) {
630 a.SetBinContent( bin, std::sqrt( (rms1*rms1) + (rms2*rms2) ) );
631 a.SetBinError( bin, std::sqrt( (e1*e1) + (e2*e2) ) );
632 }
633 else {
634 double rmstot = std::sqrt( ( (std::pow(n1 * rms1,2) / (n1 - 1)) + (std::pow(n2 * rms2, 2) / (n2 - 1)) ) * (ntot - 1) / std::pow(ntot,2) );
635 a.SetBinContent( bin, rmstot );
636 a.SetBinError( bin, rmstot / std::sqrt( 2 * ntot ) );
637 }
638 }
639
640 a.SetEntries(nEntries);
641}
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
double e1(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 1st sampling

◆ merge_RMSpercentDeviation()

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

Definition at line 643 of file MonitoringFile_MergeAlgs.cxx.

643 {
644
645 //Merge histograms where bins are filled with RMS type data which has
646 // been normalized to a percent deviation by use of a reference, using
647 // content = 100 * (RMS - reference) / reference = (RMS * 100 / reference) - 100
648 // error = RMSerror * 100 / reference.
649
650 // Once constant term (100) is added back in, treatment is the same as with merge_RMS above:
651
652 // Add in quadrature, weighted by the number of events as
653 // reconstructed from the errors.
654
655 // Author: Evan Wulf
656
657 if (a.GetDimension() != b.GetDimension()) {
658 std::cerr<<"merge_RMSpercentDeviation \"" << 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_RMSpercentDeviation \"" << a.GetName() <<"\": attempt to merge histograms of different sizes\n";
666 return;
667 }
668
669 double nEntries = a.GetEntries();
670 nEntries += b.GetEntries();
671
672 for( int bin = 0; bin < ncells; bin++ ) {
673 double y1 = a.GetBinContent(bin) + 100;
674 double y2 = b.GetBinContent(bin) + 100;
675 double e1 = a.GetBinError(bin);
676 double e2 = b.GetBinError(bin);
677
678 double n1 = 0;
679 double n2 = 0;
680
681 if( e1 != 0 ) {
682 n1 = pow( y1 / e1, 2) / 2;
683 }
684 if( e2 != 0 ) {
685 n2 = pow( y2 / e2, 2) / 2;
686 }
687
688 double ntot = n1 + n2;
689 if( ntot <= 0 ) {
690 a.SetBinContent( bin, std::sqrt( (y1*y1) + (y2*y2) ) - 100 );
691 a.SetBinError( bin, std::sqrt( (e1*e1) + (e2*e2) ) );
692 }
693 else {
694 double ytot = std::sqrt( ( (std::pow(n1 * y1,2) / (n1 - 1)) + (std::pow(n2 * y2, 2) / (n2 - 1)) ) * (ntot - 1) / std::pow(ntot,2) );
695 a.SetBinContent( bin, ytot - 100);
696 a.SetBinError( bin, ytot / std::sqrt( 2 * ntot ) );
697 }
698 }
699
700 a.SetEntries(nEntries);
701}

◆ merge_weightedAverage()

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

Definition at line 303 of file MonitoringFile_MergeAlgs.cxx.

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

◆ merge_weightedAverage2D()

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

Definition at line 380 of file MonitoringFile_MergeAlgs.cxx.

381{
382 // Author: Frank Berghaus
383 for( int binx = 0; binx <= a.GetNbinsX()+1; binx++ ) {
384 for( int biny = 0; biny <= a.GetNbinsY()+1; biny++ ) {
385
386 int bin = a.GetBin(binx,biny);
387
388 double y1 = a.GetBinContent(bin);
389 double y2 = b.GetBinContent(bin);
390 double e1 = a.GetBinError(bin);
391 double e2 = b.GetBinError(bin);
392 double w1 = 1., w2 = 1.;
393 if (e1 > 0) w1 = 1./(e1*e1);
394 if (e2 > 0) w2 = 1./(e2*e2);
395
396 // case 1:
397 if (e1 > 0 && e2 > 0){
398 a.SetBinContent(bin, (w1*y1 + w2*y2)/(w1 + w2));
399 a.SetBinError(bin, 1./std::sqrt(w1 + w2));
400 }
401 // case 2:
402 else if (e2 > 0){
403 a.SetBinContent(bin, y2);
404 a.SetBinError(bin, e2);
405 }
406 // case 3:
407 else if (e1 > 0){
408 a.SetBinContent(bin, y1);
409 a.SetBinError(bin, e1);
410 }
411 // case 4:
412 else {
413 a.SetBinContent(bin, (y1 + y2)/2.);
414 a.SetBinError(bin, 0.);
415 }
416 }
417 }
418}

◆ merge_weightedEff()

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

Definition at line 421 of file MonitoringFile_MergeAlgs.cxx.

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

◆ mergeFiles() [1/2]

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

◆ mergeFiles() [2/2]

int dqutils::MonitoringFile::mergeFiles ( const std::string & outFileName,
const std::vector< std::string > & files,
fileLBMap_t & lbMap,
bool fillLBDirs = true )

◆ mergeLB_processLBinterval()

int dqutils::MonitoringFile::mergeLB_processLBinterval ( TFile * file,
const std::vector< std::string > & inputDirNames,
const std::string & outputDirName )
private

◆ mergeLBintervals()

int dqutils::MonitoringFile::mergeLBintervals ( const std::string & inFilename)

◆ 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
void TwoDto1D_Mean(TH2 *h_parent, TH1 *h_child, int rebinning=1)
void TwoDto2D_Eff(TH2 *Numerator, TH2 *Denominator, TH2 *Efficiency, bool rebin2d=false)
void TwoDto1D_Sum(TH2 *h_parent, TH1 *h_child, int rebinning=2)
void SetMassInfo(int iBin, TH1 *InputHist, TH1 *OutMean, TH1 *OutSigma, TString recalg_path)
const char *const SegStationName[17]
std::string dirname(std::string name)
Definition utils.cxx:200

◆ 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 }
static void MuonTrack_Main(const std::string &inFileName, TString dirname)

◆ nTGCWireStripMap()

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

Definition at line 958 of file MonitoringFile_TGCPostProcess.cxx.

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

◆ 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 }
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
static const bool rno_debug
str infile
Definition run.py:13

◆ 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 }
static void fitMergedFile_DiMuMonAll(TFile *f, const std::string &run_dir, const std::string &resonName, const std::string &triggerName)

◆ 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 }
void plotResolution(const TString &coordinate, const TString &versus)

◆ 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 }
int sign(int a)
static bool RPCCheckHistogram(TFile *f, const char *HistoName)
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
bool isA(const uint32_t sourceid)
constexpr int nEta
Default bin number of eta for vertex map.
constexpr int nPhi
Default bin number of phi for vertex map.
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.
writeToFile(histDict, fOut)
StripCluster_v1 StripCluster
Define the version of the strip cluster class.

◆ setCheckEquality()

void dqutils::MonitoringFile::setCheckEquality ( bool value)
static

◆ setCompressionLevel()

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

Definition at line 450 of file MonitoringFile.h.

◆ setDebugLevel()

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()

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(std::move(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
Scalar phi() const
phi method
static const bool tgc_debug
static const float TGCChamberEfficiencyCut

◆ 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(std::move(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(std::move(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
static int nTGCWireStripMap(int ws, int etac, int phi48)
static const float TGCChamberHighOccupancyCut
static const float TGCChamberLowOccupancyCut

◆ 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(std::move(p));
767 } else {
768 badrotimingchambers.push_back(std::move(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
double hsum(TH1 *h)
sum the bin contents including the over and underflow bins
Definition chains.cxx:101
static const float TGCChamberTimingCut

◆ 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 noisychannels.emplace_back(ss.str(), occu);
914 }
915 }//bin
916 }//subsect
917 }//lay
918 }//loop over ws
919 }//loop over ac
920 }//while
921 }//MonitoringFile::TGCChannelOccupancy
static void TGCsubsect2sectorphi(int subsect, int &sector, int &phi4)
static const float TGCChannelOccupancyCut

◆ 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
static void TGCLV1HistogramDivision(const std::string &inFilename)
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 TGCChamberTiming(const std::string &inFilename, std::vector< std::pair< std::string, float > > &pro, std::vector< std::pair< std::string, float > > &ptrg)
static void TGCChamberEfficiency(const std::string &inFilename, std::vector< std::pair< std::string, float > > &p)
static void TGCRawHistogramDivision(const std::string &inFilename)

◆ 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 1119 of file MonitoringFile_TGCPostProcess.cxx.

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

◆ 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 951 of file MonitoringFile_TGCPostProcess.cxx.

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

◆ TGCsubsectbin2stationeta()

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

Definition at line 924 of file MonitoringFile_TGCPostProcess.cxx.

924 {
925 if (subsect % 2 == 1) {//including forward chamber
926 if (bin <= 15) {
927 station = 1;
928 eta = (bin - 1) % 5;
929 } else if (bin <= 27) {
930 station = 2;
931 eta = (bin - 16) % 6;
932 } else {
933 station = 3;
934 eta = (bin - 28) % 6;
935 }
936 } else {
937 if (bin <= 12) {
938 station = 1;
939 eta = (bin - 1) % 4 + 1;
940 } else if (bin <= 22) {
941 station = 2;
942 eta = (bin - 13) % 5 + 1;
943 } else {
944 station = 3;
945 eta = (bin - 23) % 5 + 1;
946 }
947 }
948 }//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 }
std::string getenv(const std::string &variableName)
get an environment variable
int updateHists(const std::string &inFileName, const std::string &inStem, const std::string &outFileName="", const std::string &outStem="")

Member Data Documentation

◆ m_cpuPerHistogram

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

Definition at line 442 of file MonitoringFile.h.

◆ m_dbgLvl

debugLevel_t dqutils::MonitoringFile::m_dbgLvl {none}
private

Definition at line 427 of file MonitoringFile.h.

427{none};

◆ m_doTiming

bool dqutils::MonitoringFile::m_doTiming
staticprivate

Definition at line 441 of file MonitoringFile.h.

◆ m_file

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

Definition at line 420 of file MonitoringFile.h.

420{};

◆ m_fileCompressionLevel

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

Definition at line 440 of file MonitoringFile.h.

◆ m_mergeMatchDirRE

std::optional<std::regex> dqutils::MonitoringFile::m_mergeMatchDirRE
private

Definition at line 439 of file MonitoringFile.h.

◆ m_mergeMatchHistoRE

std::optional<std::regex> dqutils::MonitoringFile::m_mergeMatchHistoRE
private

Definition at line 438 of file MonitoringFile.h.

◆ s_checkEquality

bool dqutils::MonitoringFile::s_checkEquality
staticprivate

Definition at line 443 of file MonitoringFile.h.


The documentation for this class was generated from the following files: