ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LArSamples::LArCellsEmptyMonitoring Class Reference

#include <LArCellsEmptyMonitoring.h>

Collaboration diagram for LArSamples::LArCellsEmptyMonitoring:

Public Member Functions

 LArCellsEmptyMonitoring ()
 
 ~LArCellsEmptyMonitoring ()
 
 LArCellsEmptyMonitoring (const LArCellsEmptyMonitoring &)=delete
 
LArCellsEmptyMonitoringoperator= (const LArCellsEmptyMonitoring &)=delete
 
void Run (const TString &inputfile)
 
void Run (const char *inputfile)
 
void TestRun (const TString &inputfile)
 
void TestRun (const char *inputfile)
 
void GetLimits_EqLB (const char *inputfile, int &lbmin, int &lbmax, int &emin, int &emax, int &qmin, int &qmax, int &runNumber, const std::vector< int, std::allocator< int > > &BadLBList)
 
std::vector< int, std::allocator< int > > ReadBadLBList (const TString &LBfile)
 
std::vector< int, std::allocator< int > > GetBadLBList (const char *inputfile, int lbmin, int lbmax, double nsigma, int nlb, const std::vector< int, std::allocator< int > > &DQLBList)
 
bool CheckBadLBList (int lumiBlock, const std::vector< int, std::allocator< int > > &BadLBList)
 
void GetMeanCellHits (const char *inputfile, int nlb, int lbmin, int lbmax, int nsigma, const std::vector< int, std::allocator< int > > &BadLBList, double &MeanHits, double &rmsHits, int &nlb_corr)
 
bool CheckEventSelectionCriteria (int lumiBlock, int nsigma, double energy, Float_t noise, int lbmin, int lbmax)
 
int CheckCellSelectionCriteria (int EventCount, int nsigmaHits, double MeanHits, double rmsHits, int nEvents_E_gt_ecut, double EventEnergySum, int nBadLBs, int nlb) const
 
bool CheckForPresamplerCells (int index)
 
bool CheckPartition (int index) const
 
void ReadDefectLBList (bool ReadList, const TString &LBfile)
 
void SetSaveRootFile (bool flag=false)
 
void SetSaveRootTree (bool flag=false)
 
void SetSaveTextFile (bool flag=false)
 
void SetSelectRecurringBadCells (bool flag=false)
 
void SetAlgo (int algoindex=2)
 
void SetNsigmaHitsFromMean (double nsigmahits=10.)
 
void SetLumiblockRange (bool inputRange=false, int input_lbmin=0, int input_lbmax=0)
 
void SetBadLBRemovalOption (bool removeLB=true)
 
void SetQthreshold (int qvalue=4000)
 
void SetNoiseNsigma (double nsig=10.)
 
void SetEnergyCountThresholds (double ecut=1., int counts1=250, double enecell1=1.5, int counts2=25, double enecell2=30)
 
void SetPresamplerMask (bool PS=false)
 
void SetCaloMask (bool calo=false)
 
void SetPartition (bool setpart, const std::string &partname)
 
std::string GetCryostat (int calo)
 
void ScanOnlids (const TString &inputfile)
 
void DoEtaPhiMonitoring (const char *inputfile, const char *optionplot, const char *optionsave)
 
void TriggerEfficiency (const char *inputfile, float fractionInPS=0.8)
 

Private Attributes

std::unique_ptr< LArIdTranslatorHelperm_LarIdTranslator
 
int m_nexpected
 
bool m_SaveRootFile
 
bool m_SaveRootTree
 
bool m_SaveTextFile
 
int m_Algo
 
bool m_SetLumiblockRange
 
int m_input_lbmin
 
int m_input_lbmax
 
bool m_RemoveBadLB
 
int m_Qthreshold
 
double m_nsigma
 
double m_nsigmaHits
 
double m_Ethreshold
 
int m_UpperCountThreshold
 
int m_LowerCountThreshold
 
double m_LowerCellEnergyThreshold
 
double m_UpperCellEnergyThreshold
 
bool m_MaskPresampler = false
 
bool m_MaskCalo = false
 
bool m_SelectRecurringBadCells
 
bool m_SetPartition
 
int m_PartitionIndex = 0
 
std::string m_PartitionName
 
double m_Mean_checkBadLBs = 0.0
 
double m_RMS_checkBadLBs = 0.0
 
bool m_ReadDefectLBList = false
 
TString m_LBfile
 

Detailed Description

@Basic class aimed at running simple LAr monitoring function on ntuples produced from that very same package.

Definition at line 23 of file LArCellsEmptyMonitoring.h.

Constructor & Destructor Documentation

◆ LArCellsEmptyMonitoring() [1/2]

LArCellsEmptyMonitoring::LArCellsEmptyMonitoring ( )

Definition at line 63 of file LArCellsEmptyMonitoring.cxx.

64  : m_LarIdTranslator (std::make_unique<LArIdTranslatorHelper>("LarIdTree.root"))
65 {
66  // class constructor - set your class variables to default values here
67 
68  m_nexpected = 195072; // entries expected from Calo container
69 
70 
71  m_SaveRootFile = false;
72  m_SaveTextFile = true;
73  m_Algo = 2;
74  m_SetLumiblockRange = false;
75  m_input_lbmin = 0;
76  m_input_lbmax = 0;
77  m_RemoveBadLB = true;
78  m_Qthreshold = 4000;
79  m_nsigma = 4.;
80  m_Ethreshold = 1.;
86  m_nsigmaHits = 10.;
87  m_SaveRootTree = false;
88  m_SetPartition = false;
89 }

◆ ~LArCellsEmptyMonitoring()

LArCellsEmptyMonitoring::~LArCellsEmptyMonitoring ( )

Definition at line 91 of file LArCellsEmptyMonitoring.cxx.

92 {
93 }

◆ LArCellsEmptyMonitoring() [2/2]

LArSamples::LArCellsEmptyMonitoring::LArCellsEmptyMonitoring ( const LArCellsEmptyMonitoring )
delete

Member Function Documentation

◆ CheckBadLBList()

bool LArCellsEmptyMonitoring::CheckBadLBList ( int  lumiBlock,
const std::vector< int, std::allocator< int > > &  BadLBList 
)

Definition at line 1224 of file LArCellsEmptyMonitoring.cxx.

1224  {
1225  for (unsigned int yy=0;yy<BadLBList.size();yy++){
1226  if (lumiBlock == BadLBList[yy]){
1227  return true;
1228  }
1229  }
1230  return false;
1231 }

◆ CheckCellSelectionCriteria()

int LArCellsEmptyMonitoring::CheckCellSelectionCriteria ( int  EventCount,
int  nsigmaHits,
double  MeanHits,
double  rmsHits,
int  nEvents_E_gt_ecut,
double  EventEnergySum,
int  nBadLBs,
int  nlb 
) const

Definition at line 1338 of file LArCellsEmptyMonitoring.cxx.

1338  {
1339  //FLAG KEY:
1340  //selectionFlag == 0 -> Used EventEnergyCut
1341  //selectionFlag == 1 -> Used MeanCellHitCut
1342  //selectionFlag == 2 -> Used EventEnergyCut && MeanCellHitCut
1343 
1344 
1345  bool a=false;
1346  bool b=false;
1347  bool c=false;
1348 
1349  //pas bon if ((EventCount > (MeanHits[GetSectionIndex(index)]+(nsigmaHits*rmsHits[GetSectionIndex(index)]))*(nlb-nBadLBs[GetCryoIndex(index)]))) a=true;
1350 
1351  //original
1352  if ((EventCount > (MeanHits+(nsigmaHits*rmsHits))*((double)nlb-(double)nBadLBs))) a=true;
1353  // reverse cut
1354  // if ((EventCount < (MeanHits+(nsigmaHits*rmsHits))*((double)nlb-(double)nBadLBs))) a=true;
1355 
1356  //original
1357  if (nEvents_E_gt_ecut > m_UpperCountThreshold && (EventEnergySum/(double)nEvents_E_gt_ecut) > m_LowerCellEnergyThreshold) b=true;
1358  // reverse cut
1359  // if (nEvents_E_gt_ecut < m_UpperCountThreshold && (EventEnergySum/(double)nEvents_E_gt_ecut) < m_LowerCellEnergyThreshold) b=true;
1360 
1361  //original
1362  if (nEvents_E_gt_ecut > m_LowerCountThreshold && (EventEnergySum/(double)nEvents_E_gt_ecut) > m_UpperCellEnergyThreshold) c=true;
1363  // reverse cut
1364  // if (nEvents_E_gt_ecut < m_LowerCountThreshold && (EventEnergySum/(double)nEvents_E_gt_ecut) < m_UpperCellEnergyThreshold) c=true;
1365 
1366 
1367  if ((a && b) || (a && c)){
1368  return 2;
1369  } else if (a && !b && !c){
1370  return 1;
1371  } else if ((!a && b) || (!a && c)){
1372  return 0;
1373  }
1374 
1375  return -1;
1376 }

◆ CheckEventSelectionCriteria()

bool LArCellsEmptyMonitoring::CheckEventSelectionCriteria ( int  lumiBlock,
int  nsigma,
double  energy,
Float_t  noise,
int  lbmin,
int  lbmax 
)

Definition at line 1324 of file LArCellsEmptyMonitoring.cxx.

1324  {
1325 
1326 
1327  if (energy == 0 || noise == 0){
1328  return false;
1329  } else if (lumiBlock <= lbmax && lumiBlock >= lbmin && energy > sqrt((nsigma*noise)*(nsigma*noise)) ) { // use only LBs in range
1330  return true;
1331  }
1332  return false;
1333 
1334 }

◆ CheckForPresamplerCells()

bool LArCellsEmptyMonitoring::CheckForPresamplerCells ( int  index)

Definition at line 1379 of file LArCellsEmptyMonitoring.cxx.

1379  {
1380 
1381  return index == 0 || index == 4;
1382 }

◆ CheckPartition()

bool LArCellsEmptyMonitoring::CheckPartition ( int  index) const

Definition at line 1385 of file LArCellsEmptyMonitoring.cxx.

1385  {
1386  return index == m_PartitionIndex;
1387 }

◆ DoEtaPhiMonitoring()

void LArCellsEmptyMonitoring::DoEtaPhiMonitoring ( const char *  inputfile,
const char *  optionplot,
const char *  optionsave 
)

Definition at line 1558 of file LArCellsEmptyMonitoring.cxx.

1559 {
1560  // Main monitoring function with primary goal to produce simple DQM-equivalent (eta,phi) maps.
1561  // Depending on the argument, the function will put different quantities in the histograms.
1562  // Currently supported options:
1563  //
1564  // - optionplot = "NAbove4Sigma","PercentageAbove4Sigma",
1565  // "NAbove5Sigma","PercentageAbove5Sigma",
1566  // "NQualityAbove4000","PercentageQualityAbove4000"
1567  // - optionsave = "root","png"
1568  //
1569  //
1570 
1571  printf("LArCellsEmptyMonitoring::DoEtaPhiMonitoring: Reading options: %s %s.\n",optionplot,optionsave);
1572 
1573  bool knormplot = false;
1574  if(strstr(optionplot,"Precentage")) knormplot = true; // needs normalization plots
1575 
1576  int kcuttype = 0; // no cut
1577  double nsigmacut = 0.;
1578  double qualitycut = 0.;
1579  if(strstr(optionplot,"Sigma")){
1580  kcuttype = 1; // energy
1581  if(strstr(optionplot,"4Sigma")) nsigmacut = 4.;
1582  if(strstr(optionplot,"5Sigma")) nsigmacut = 5.;
1583  } else if(strstr(optionplot,"Quality")){
1584  kcuttype = 2; // quality
1585  qualitycut = 4000.; // not much control for now
1586  }
1587 
1588  Char_t hname[512];
1589  int index = 0;
1590  int nskipped=0;
1591  ULong64_t onlid = 0;
1592 
1593  // Opening file:
1594  std::unique_ptr<LArSamples::Interface> tuple((LArSamples::Interface*)Interface::open(inputfile));
1595  printf("Number of events: %u %u\n",tuple->nEvents(),tuple->nChannels());
1596  unsigned int nchannels = tuple->nChannels();
1597 
1598  // eta-phi maps
1599  const int nhists = m_LarIdTranslator->GetNpl();
1600  TH2F** hmap_counts_all = new TH2F*[nhists];
1601  TH2F** hmap_energy_cut = new TH2F*[nhists];
1602  TH2F** hmap_quality_cut = new TH2F*[nhists];
1603  for(int j=0;j<nhists;j++){
1604  hmap_counts_all[j] = (TH2F*)m_LarIdTranslator->GetCaloPartitionLayerMap(j);
1605  sprintf(hname,"counst_all_%s_%d",m_LarIdTranslator->GetPartitonLayerName(j),j);
1606  hmap_counts_all[j]->SetName(hname);
1607  //
1608  hmap_energy_cut[j] = (TH2F*)m_LarIdTranslator->GetCaloPartitionLayerMap(j);
1609  sprintf(hname,"energy_cut_%s_%d",m_LarIdTranslator->GetPartitonLayerName(j),j);
1610  hmap_energy_cut[j]->SetName(hname);
1611  //
1612  hmap_quality_cut[j] = (TH2F*)m_LarIdTranslator->GetCaloPartitionLayerMap(j);
1613  sprintf(hname,"quality_cut_%s_%d",m_LarIdTranslator->GetPartitonLayerName(j),j);
1614  hmap_quality_cut[j]->SetName(hname);
1615  }
1616 
1617  // -------------------------------------------------------------------------
1618  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1619  // pass empty cells
1620  if(tuple->historySize(ichan)==0){ nskipped++; continue; }
1621 
1622  // process non empty cells
1623  const LArSamples::History* hist = tuple->cellHistory(ichan);
1624  const LArSamples::CellInfo* cellInfo = hist->cellInfo();
1625  unsigned int ndigits = hist->nData();
1626  if(ndigits==0){ nskipped++; continue; }
1627 
1628  // index for partition
1629  index = m_LarIdTranslator->GetPartitionLayerIndex(cellInfo->calo(),cellInfo->layer());
1630  // onlid = m_LarIdTranslator->onlid;
1631  onlid = cellInfo->onlid();
1632  if(onlid<=0) printf("%u: Bad Cell Onlid = 0x%x (%+.2f,%+.2f)\n",ichan,(unsigned int)onlid,cellInfo->eta(),cellInfo->phi());
1633 
1634  // loop on the events for each cells
1635  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
1636  const LArSamples::Data* data = hist->data(idigit);
1637  //const LArSamples::EventData* Evdata = data->eventData();
1638 
1639  // all stats
1640  hmap_counts_all[index]->Fill(m_LarIdTranslator->eta,m_LarIdTranslator->phi);
1641 
1642  // energy-like
1643  if(kcuttype==1 && data->noise()>0.){
1644  if((data->energy()/data->noise())>nsigmacut) hmap_energy_cut[index]->Fill(m_LarIdTranslator->eta,m_LarIdTranslator->phi);
1645  }
1646  if(kcuttype==2){
1647  if(data->quality()>qualitycut) hmap_quality_cut[index]->Fill(m_LarIdTranslator->eta,m_LarIdTranslator->phi);
1648  }
1649  }
1650  }
1651 
1652  int nbad = m_nexpected-nskipped;
1653  printf("Skipped %d cells. Bad Cells = %d\n",nskipped,nbad);
1654 
1655  // normalize, if needed
1656  if(knormplot){
1657  for(int j=0;j<nhists;j++){
1658  hmap_energy_cut[j]->Divide(hmap_counts_all[j]);
1659  hmap_quality_cut[j]->Divide(hmap_counts_all[j]);
1660  }
1661  }
1662 
1663  std::unique_ptr<TFile> tout;
1664  TCanvas* c0 = nullptr, *c1 = nullptr;
1665 
1666  if(!strcmp(optionsave,"root")){
1667  tout.reset(new TFile("EtaPhiMonitoring.root","recreate"));
1668  c0 = m_LarIdTranslator->CaloPartitionLayerDisplay((TH1**)hmap_counts_all,"Counts",1);
1669  c0->SetName("Normalization");
1670  c0->Write();
1671  for(int j=0;j<nhists;j++) hmap_counts_all[j]->Write();
1672  if(kcuttype==1){
1673  c0 = m_LarIdTranslator->CaloPartitionLayerDisplay((TH1**)hmap_energy_cut,"EnergyCut",1);
1674  c0->SetName("EnergyCut");
1675  c0->Write();
1676  for(int j=0;j<nhists;j++) hmap_energy_cut[j]->Write();
1677  }
1678  if(kcuttype==2){
1679  c0 = m_LarIdTranslator->CaloPartitionLayerDisplay((TH1**)hmap_quality_cut,"QualityCut",1);
1680  c0->SetName("QualityCut");
1681  c0->Write();
1682  for(int j=0;j<nhists;j++) hmap_quality_cut[j]->Write();
1683  }
1684  tout->Close();
1685  } else {
1686  c0 = m_LarIdTranslator->CaloPartitionLayerDisplay((TH1**)hmap_counts_all,"Counts",1);
1687  c0->SaveAs("Normalization.png");
1688  c1 = new TCanvas("c1","");
1689  for(int j=0;j<nhists;j++){ hmap_counts_all[j]->Draw("colz"); sprintf(hname,"%s.png",hmap_counts_all[j]->GetName()); c1->SaveAs(hname); }
1690  if(kcuttype==1){
1691  c0 = m_LarIdTranslator->CaloPartitionLayerDisplay((TH1**)hmap_energy_cut,"EnergyCut",1);
1692  c0->SaveAs("EnergyCut.png");
1693  c1->cd();
1694  for(int j=0;j<nhists;j++){ hmap_energy_cut[j]->Draw("colz"); sprintf(hname,"%s.png",hmap_energy_cut[j]->GetName()); c1->SaveAs(hname); }
1695  }
1696  if(kcuttype==2){
1697  c0 = m_LarIdTranslator->CaloPartitionLayerDisplay((TH1**)hmap_quality_cut,"QualityCut",1);
1698  c0->SaveAs("QualityCut.png");
1699  c1->cd();
1700  for(int j=0;j<nhists;j++){ hmap_quality_cut[j]->Draw("colz"); sprintf(hname,"%s.png",hmap_quality_cut[j]->GetName()); c1->SaveAs(hname); }
1701  }
1702  }
1703  delete[] hmap_counts_all;
1704  delete[] hmap_energy_cut;
1705  delete[] hmap_quality_cut;
1706  return;
1707 }

◆ GetBadLBList()

std::vector< int, std::allocator< int > > LArCellsEmptyMonitoring::GetBadLBList ( const char *  inputfile,
int  lbmin,
int  lbmax,
double  nsigma,
int  nlb,
const std::vector< int, std::allocator< int > > &  DQLBList 
)

Definition at line 1070 of file LArCellsEmptyMonitoring.cxx.

1070  {
1071  std::map< std::pair<unsigned int, unsigned int>, unsigned int > eventCells_tot;
1072  std::map< std::pair<unsigned int, unsigned int>, double > eventEnergy_tot;
1073  std::map< std::pair<unsigned int, unsigned int>, unsigned int > eventLumiBlock;
1074  std::map< std::pair<std::string, unsigned int>, unsigned int > eventCells;
1075  int lb=0.;
1076  double NSIG = nsigma;
1077 
1078  // Opening file:
1080  unsigned int nchannels = tuple->nChannels();
1081 
1082  // -------------------------------------------------------------------------
1083  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1084  // pass empty cells
1085  if(tuple->historySize(ichan)==0){ continue; }
1086 
1087  // process non empty cells
1088  const LArSamples::History* hist = tuple->cellHistory(ichan);
1089  const LArSamples::CellInfo* cellInfo = hist->cellInfo();
1090  int index = m_LarIdTranslator->GetPartitionLayerIndex(cellInfo->calo(),cellInfo->layer());
1091  int calo = cellInfo->calo();
1092 
1093  if (m_MaskPresampler){
1094  if (CheckForPresamplerCells(index)){ continue; }
1095  }
1096  if (m_MaskCalo){
1097  if (!CheckForPresamplerCells(index)){ continue; }
1098  }
1099 
1100  unsigned int ndigits = hist->nData();
1101  if(ndigits==0){ continue; }
1102 
1103  // loop on the events for each cell
1104  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
1105  const LArSamples::Data* data = hist->data(idigit);
1106 
1107  const LArSamples::EventData* Evdata = data->eventData();
1108  if(!Evdata) continue;
1109  int lumiBlock = Evdata->lumiBlock();
1110  //int lumiBlock = data->lumiBlock();
1111 
1112  lb = (int)lumiBlock;
1113  double energyGeV = data->energy()/1000.;
1114 
1115 
1116  if (lumiBlock <= lbmax && lumiBlock >= lbmin ) { // use only LBs in range
1117  if (data->energy() > sqrt((NSIG*data->noise())*(NSIG*data->noise())) && data->energy() != 0. && data->noise() != 0.){ // record only events with E>NSIG and real energy/noise values
1118  // cell-event mapping
1119  std::pair<unsigned int, unsigned int> ev(data->run(), data->event());
1120  std::pair<std::string, unsigned int> ev_cryo(GetCryostat(calo), data->event());
1121  eventCells_tot[ev]++;
1122  eventEnergy_tot[ev] += energyGeV;
1123  eventLumiBlock[ev] = lb;
1124  eventCells[ev_cryo]++;
1125  }
1126  }
1127  }
1128  }
1129  // -------------------------------------------------------------------------
1130  // Find Bad LBs -> make list (BadLB vector output)
1131  // -------------------------------------------------------------------------
1132  auto hCells_Ev_LB = std::make_unique<TProfile>("","",nlb,lbmin,lbmax,-100,100000);//averaged number of cells per event per LB
1133  std::map< std::string, TProfilep> hCellsEvLB;
1134  std::map< std::string, TH1Fp> hp_cryo;
1135  // -------------------------------------------------------------------------
1136  // loop over events (based on Interface::ShowEvents).
1137  // -------------------------------------------------------------------------
1138  int nCryo = 8;
1139  std::string Cryo[8] = {"EMBA","EMBC","EMECA","EMECC","HECA", "HECC","FCALA","FCALC"};
1140  for(int k = 0; k< nCryo; k++){
1141  hCellsEvLB[Cryo[k]].reset((TProfile*)hCells_Ev_LB->Clone());
1142  }
1143  for(unsigned int ievent = 0; ievent < tuple->nEvents(); ievent++) {
1144  const LArSamples::EventData* evtData = tuple->eventData(ievent);
1145  std::pair<unsigned int, unsigned int> id(evtData->run(), evtData->event());
1146  if(eventCells_tot[id]==0) continue;
1147 
1148  for(int j=0; j<nCryo ;j++){
1149  std::pair<std::string, unsigned int> id_cryo(Cryo[j], evtData->event());
1150  hCellsEvLB[Cryo[j]]->Fill(eventLumiBlock[id], eventCells[id_cryo]);
1151  }
1152 
1153  hCells_Ev_LB->Fill(eventLumiBlock[id], eventCells_tot[id]);
1154  }
1155 
1156  auto hp = std::make_unique<TH1F>("","",(hCells_Ev_LB->GetBinContent(hCells_Ev_LB->GetMaximumBin())),0,hCells_Ev_LB->GetBinContent(hCells_Ev_LB->GetMaximumBin()));// histo to find average number of cells firing per event per LB
1157  for(int k = 0; k< nCryo; k++){
1158  auto hp_temp = std::make_unique< TH1F>("","",(hCellsEvLB[Cryo[k]]->GetBinContent(hCellsEvLB[Cryo[k]]->GetMaximumBin())*10),0,hCellsEvLB[Cryo[k]]->GetBinContent(hCellsEvLB[Cryo[k]]->GetMaximumBin()));// histo to find average number of cells firing per event per LB
1159  std::string name1 = "hp_" + Cryo[k];
1160  hp_cryo[Cryo[k]].reset((TH1F*)hp_temp->Clone(name1.c_str()));
1161  }
1162 
1163  for (int p=1;p<=nlb;p++){
1164  for(int j=0; j<nCryo; j++){
1165  double bincont = hCellsEvLB[Cryo[j]]->GetBinContent(p);
1166  hp_cryo[Cryo[j]]->Fill(bincont);
1167  }
1168  double bincont1 = hCells_Ev_LB->GetBinContent(p);
1169  hp->Fill(bincont1);
1170  }
1171 
1172  std::map< std::string, double> Mean;
1173  std::map< std::string, double> RMS;
1174  std::map< int, vector<std::string> > BadLB_cryo;
1175 
1176  for(int k=0; k<nCryo; k++)
1177  {
1178  Mean[Cryo[k]] = hp_cryo[Cryo[k]]->GetMean();
1179  RMS[Cryo[k]] = hp_cryo[Cryo[k]]->GetRMS();
1180  }
1181 
1182  double MEAN2 = hp->GetMean();
1183  double RMS2 = hp->GetRMS();
1184  m_Mean_checkBadLBs = MEAN2;
1185  m_RMS_checkBadLBs = RMS2;
1186  vector<int> BadLB;
1187  // vector<int> BadLB_tot;
1188  vector<int> BadLB_tot=DQLBList;
1189 
1190  double value1 = (MEAN2+(RMS2*3.));
1191  int numberFlagged=0;
1192  for (int l=1;l<=nlb;l++){
1193  for(int j=0; j<nCryo; j++){
1194  double value = MEAN2 + (RMS[Cryo[j]]*3);
1195  if(hCellsEvLB[Cryo[j]]->GetBinContent(l) > value){
1196  int badLB = hCellsEvLB[Cryo[j]]->GetBinLowEdge(l);
1197  BadLB_cryo[badLB].push_back(Cryo[j]);
1198  bool isadd = true;
1199  for(unsigned int p=0; p< BadLB_tot.size(); p++) {
1200  if(badLB == BadLB_tot[p]) isadd = false;
1201  }
1202  if(isadd){
1203  BadLB_tot.push_back(badLB);
1204  numberFlagged++;
1205  printf("Removing bad LB %d in %s\n",badLB,Cryo[j].c_str());
1206  }
1207  }
1208  }
1209 
1210  if (hCells_Ev_LB->GetBinContent(l) > value1){
1211  BadLB.push_back(hCells_Ev_LB->GetBinLowEdge(l));
1212  }
1213  }
1214  printf("\n");
1215  printf("Number of Bad LBs found: %d\n",numberFlagged);
1216  printf("Number of LBs to be removed: %zu", BadLB_tot.size());
1217  printf("\n");
1218 
1219  return BadLB_tot;
1220 }

◆ GetCryostat()

std::string LArCellsEmptyMonitoring::GetCryostat ( int  calo)

Definition at line 1420 of file LArCellsEmptyMonitoring.cxx.

1421 {
1422  std::string cryostat = "NotGiven";
1423  if(calo == 1) cryostat = "EMBA";
1424  else if(calo == -1) cryostat = "EMBC";
1425  else if(calo == 5) cryostat = "FCALA";
1426  else if(calo == -5) cryostat = "FCALC";
1427  else if(calo == 4) cryostat = "HECA";
1428  else if(calo == -4) cryostat = "HECC";
1429  else if(calo == 2 || calo == 3) cryostat = "EMECA";
1430  else if(calo == -2 || calo == -3) cryostat = "EMECC";
1431  return cryostat;
1432 }

◆ GetLimits_EqLB()

void LArCellsEmptyMonitoring::GetLimits_EqLB ( const char *  inputfile,
int &  lbmin,
int &  lbmax,
int &  emin,
int &  emax,
int &  qmin,
int &  qmax,
int &  runNumber,
const std::vector< int, std::allocator< int > > &  BadLBList 
)

Definition at line 1017 of file LArCellsEmptyMonitoring.cxx.

1017  {
1018  int lb=0.;
1019 
1020  // Opening file:
1022 
1023  unsigned int nchannels = tuple->nChannels();
1024 
1025  // -------------------------------------------------------------------------
1026  qmin = emin = lbmin = 99999;
1027  qmax = emax = lbmax = -1;
1028  runNumber = 0.;
1029 
1030  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1031  // pass empty cells
1032  if(tuple->historySize(ichan)==0){ continue; }
1033 
1034  // process non empty cells
1035  const LArSamples::History* hist = tuple->cellHistory(ichan);
1036 
1037  unsigned int ndigits = hist->nData();
1038  if(ndigits==0){ continue; }
1039 
1040  // loop on the events for each cells
1041  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
1042  const LArSamples::Data* data = hist->data(idigit);
1043  const LArSamples::EventData* Evdata = data->eventData();
1044  if(!Evdata) continue;
1045  int lumiBlock = Evdata->lumiBlock();
1046 
1047 
1048  if (data->energy() != 0. && data->noise() != 0.){ // record only events with real energy/noise values
1049  bool isBadLB = CheckBadLBList(lumiBlock,BadLBList);
1050  //skip bad LBs
1051  if (isBadLB) continue;
1052 
1053 
1054  lb = (int)lumiBlock;
1055  if(lb>lbmax) lbmax = lb;
1056  if(lb<lbmin) lbmin = lb;
1057  double energyGeV = data->energy()/1000.;
1058  if(energyGeV > emax) emax = energyGeV;
1059  if(energyGeV < emin) emin = energyGeV;
1060  if(data->quality() > qmax) qmax = data->quality();
1061  if(data->quality() < qmin) qmin = data->quality();
1062 
1063  runNumber = data->run();
1064  }
1065  }
1066  }
1067 }

◆ GetMeanCellHits()

void LArCellsEmptyMonitoring::GetMeanCellHits ( const char *  inputfile,
int  nlb,
int  lbmin,
int  lbmax,
int  nsigma,
const std::vector< int, std::allocator< int > > &  BadLBList,
double &  MeanHits,
double &  rmsHits,
int &  nlb_corr 
)

Definition at line 1234 of file LArCellsEmptyMonitoring.cxx.

1235 {
1236 
1237 
1238  int nHits = 0., lumiBlock = 0.,nCells = 0.;
1239  double energy = 0, noise = 0;
1240  std::unique_ptr<LArSamples::Interface> tuple((LArSamples::Interface*)Interface::open(inputfile));
1241  unsigned int nchannels = tuple->nChannels();
1242 
1243  //TH1F* h1_hits = new TH1F("","",nlb,lbmin,lbmax); // temp histo filled with every event in cell with E>4sig
1244  double TotalRecordedHits=0;
1245  std::vector<int, std::allocator<int> > HitsPerLB;
1246  double var=0;
1247  TH1Fp th1_Hits = std::make_unique<TH1F>("","",nlb,lbmin,lbmax); // number of events (E>nsig) in each LB for each cell
1248  TH1Fp hNLB = std::make_unique<TH1F>("","",nlb,lbmin,lbmax); // number of lumiblocks
1249 
1250  // -------------------------------------------------------------------------
1251  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1252  // pass empty cells
1253  if(tuple->historySize(ichan)==0){ continue; }
1254 
1255 
1256  // process non empty cells
1257  const LArSamples::History* hist = tuple->cellHistory(ichan);
1258 
1259  unsigned int ndigits = hist->nData();
1260 
1261  // loop on the events for each cells
1262  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
1263  const LArSamples::Data* data = hist->data(idigit);
1264  const LArSamples::EventData* Evdata = data->eventData();
1265  if(!Evdata) continue;
1266  lumiBlock = Evdata->lumiBlock();
1267 
1268  energy = data->energy();
1269  noise = data->noise();
1270  bool isBadLB = CheckBadLBList(lumiBlock,BadLBList);
1271  if (isBadLB) continue; //skip bad LBs
1272  hNLB->Fill(lumiBlock);
1273 
1274  bool ProcessEvent = CheckEventSelectionCriteria(lumiBlock, nsigma, energy, noise, lbmin, lbmax);
1275  if (ProcessEvent){
1276 
1277 
1278  th1_Hits->Fill(lumiBlock);
1279  nHits++;
1280  }
1281  }
1282  if (nHits > 0.) nCells++;
1283 
1284  nHits = 0.;
1285 
1286  }
1287 
1288 
1289  // -------------------------------------------------------------------------
1290  // determine average #hits per cell per LB
1291  // -------------------------------------------------------------------------
1292 
1293 
1294 
1295  TH1Fp tp_ev = std::make_unique<TH1F>("","",th1_Hits->GetBinContent(th1_Hits->GetMaximumBin())*100,0,th1_Hits->GetBinContent(th1_Hits->GetMaximumBin()));
1296 
1297  for (int i=1;i<=nlb;i++){
1298  if(hNLB->GetBinContent(i)>0){
1299  nlb_corr++;
1300  tp_ev->Fill(th1_Hits->GetBinContent(i));
1301  TotalRecordedHits+=th1_Hits->GetBinContent(i);
1302  HitsPerLB.push_back(th1_Hits->GetBinContent(i));
1303  }
1304  }
1305 
1306  MeanHits = ((double)TotalRecordedHits/(double)nlb_corr)/(double)nCells;
1307  // MeanHits = tp_ev->GetMean()/(double)nCells;
1308  // rmsHits = tp_ev->GetRMS()/(double)nCells;
1309 
1310  for (unsigned int j=0;j<HitsPerLB.size();j++){
1311  var += (((double)HitsPerLB[j]/(double)nCells) - MeanHits)*(((double)HitsPerLB[j]/(double)nCells) - MeanHits);
1312  }
1313 
1314  rmsHits = var/nlb_corr;
1315 
1316  printf("Mean number of hits/cell for 1 LB = %4.3f, RMS = %4.3f\n",MeanHits,rmsHits);
1317  printf("Number of cells firing at E > %d sigma = %d\n",nsigma,nCells);
1318  printf("Total number of LBs included = %d\n",nlb_corr);
1319 
1320 
1321 }

◆ operator=()

LArCellsEmptyMonitoring& LArSamples::LArCellsEmptyMonitoring::operator= ( const LArCellsEmptyMonitoring )
delete

◆ ReadBadLBList()

std::vector< int > LArCellsEmptyMonitoring::ReadBadLBList ( const TString &  LBfile)

Definition at line 1451 of file LArCellsEmptyMonitoring.cxx.

1452 {
1453  std::vector<int> LBList;
1454 
1455  std::ifstream infile(LBfile.Data());
1456  std::string line;
1457 
1458  // assume single-line format with coma-separated LBs (from python)
1459  std::getline(infile,line,'\n');
1460  TString filter(line.c_str());
1461  std::unique_ptr<TObjArray> list(filter.Tokenize(", ")); // coma\space delimiters
1462  if(list->GetEntries() == 0){
1463  printf("No LB filtering specified, or bad format. Exiting.\n");
1464  LBList.push_back(0);
1465  return LBList;
1466  }
1467 
1468  for(int k = 0; k < list->GetEntries(); k++){
1469  TObjString* tobs = (TObjString*)(list->At(k));
1470  LBList.push_back((int)(tobs->String()).Atoi());
1471  }
1472  printf("LB List: %d\n",(int)LBList.size());
1473  return LBList;
1474 }

◆ ReadDefectLBList()

void LArCellsEmptyMonitoring::ReadDefectLBList ( bool  ReadList,
const TString &  LBfile 
)

Definition at line 1436 of file LArCellsEmptyMonitoring.cxx.

1437 {
1438 
1439 
1440  if (!ReadList){
1441  m_LBfile="";
1442  m_ReadDefectLBList=false;
1443  }
1444  else{
1445  m_LBfile=LBfile;
1446  m_ReadDefectLBList=true;
1447  }
1448 }

◆ Run() [1/2]

void LArSamples::LArCellsEmptyMonitoring::Run ( const char *  inputfile)
inline

Definition at line 33 of file LArCellsEmptyMonitoring.h.

33 { TString str(inputfile); Run(str); } // wrapper

◆ Run() [2/2]

void LArCellsEmptyMonitoring::Run ( const TString &  inputfile)

Definition at line 422 of file LArCellsEmptyMonitoring.cxx.

423 {
424 
425  TString htitle,hname,textfilename,rootfilename;
426 
427  // partition/layer indexing entrirely defined by LarIdTranslator
428  const int npl = m_LarIdTranslator->GetNpl();
429 
430 
431  // ----------------------------------------------------
432  // Setter error messages
433  // ----------------------------------------------------
434 
435 
436  if (m_SelectRecurringBadCells && m_Algo != 2){
437  printf("WARNING: Received instruction to select recurring bad cells only in SetSelectRecurringBadCells(bool flag)\n");
438  printf("-------> Only one algorithm selected for cell selection criteria in SetAlgo(int algoindex)\n");
439  printf("-------> Recurring cell selection overides algorithm specification\n");
440  std::abort();
441  }
442 
443  if (m_SetPartition && m_PartitionIndex == -1){
444  printf("ERROR: Partition not specified in SetPartition(bool set_part, std::string partname)\n");
445  std::abort();
446  } else if (m_SetPartition){
447  printf("Running cell selection on %s only.\n",m_LarIdTranslator->GetPartitonLayerName(m_PartitionIndex));
448  }
449  // ----------------------------------------------------
450  //
451  int selectionFlag = -1;
452  const double GeV = 1/1000.;
453  const double ecut = m_Ethreshold; // GeV
454  int index = 0;
455  double nsigma = m_nsigma;
456  double nsigmaHits = m_nsigmaHits;
457  const int threshold = 10.;
458  const int qthreshold = m_Qthreshold;
459  int nskipped=0;
460  int nBadCells=0;
461  int noEvdata=0;
462  unsigned int onlid = 0;
463  int ne=0;
464  int emin=0;
465  int emax=0;
466  int nq=0;
467  int qmin=0;
468  int qmax=0;
469  int nlb=0;
470  int nlb_corr=0; // count only non-empty LBs
471  int lbmin=0;
472  int lbmax=0;
473  int runNumber=0;
474  int nEvents_E_gt_ecut=0;
475  double EventEnergySum=0.;
476  double EventEnergyMean=0.;
477 
478  int nBadLBs=0;
479  double MeanHits=0, rmsHits=0;
480  int iMeanCellHitsSelection=0,iEnergyThresholdSelection=0,iOR_selection=0,iAND_selection=0;
481  int CellCounter=0;
482 
483 
484  // Deal with bad LBs
485  // @ TODO: Do we still need this option? Not if we are always reading in the defect list at merging...?
486  vector<int, std::allocator<int> > DQLBList;
487  vector<int, std::allocator<int> > BadLBList;
488  if(m_ReadDefectLBList){
489  printf("Reading in DQ Defect LB List...\n");
490  DQLBList=ReadBadLBList(m_LBfile);
491  printf("...Done\n");
492  }
493  if (m_RemoveBadLB){
494  printf("Getting bad LB list...\n");
495  BadLBList=GetBadLBList(inputfile,lbmin,lbmax,nsigma,nlb,DQLBList);
496  printf("...Done.\n");
497  nBadLBs = BadLBList.size();
498  }
499  else if (m_ReadDefectLBList){
500  BadLBList = std::move(DQLBList);
501  nBadLBs = BadLBList.size();
502  }
503 
504  // find minimum and maximum LB, cell energy, q factor...
505  printf("Getting histogram limits... ");
506  GetLimits_EqLB(inputfile,lbmin,lbmax,emin,emax,qmin,qmax,runNumber,BadLBList);
507  if (m_SetLumiblockRange){
510  }
511 
512 
513  nlb=lbmax-lbmin;
514  ne=emax-emin;
515  nq=qmax-qmin;
516  printf("Done.\n LBmin: %d LBmax: %d Emin: %d Emax: %d Qmin: %d Qmax: %d\n",lbmin,lbmax,emin,emax,qmin,qmax);
517 
518  // Declare and open summary textfile
519  FILE * outputFile=nullptr;
520  if (!m_SetPartition){
521  textfilename.Form("Output/BadCellSelection_run%d.txt",runNumber);
522  outputFile = fopen (textfilename , "w");
523  if (!outputFile){
524  std::cout<<("Cannot open output selection summary file " + textfilename)<< "\n";
525  std::abort();}
526  } else {
527  textfilename.Form("BadCellSelection_%s_run%d.txt",m_LarIdTranslator->GetPartitonLayerName(m_PartitionIndex),runNumber);
528  outputFile = fopen (textfilename , "w");
529  if (!outputFile){
530  std::cout<<("Cannot open output selection summary file " + textfilename)<< "\n";
531  std::abort();}
532  }
533 
534 
535  // Declare and open output textfile
536  FILE * pFile=nullptr;
537  if (m_SaveTextFile){
538  if (!m_SetPartition){
539  textfilename.Form("Output/BadCellList_run%d.txt",runNumber);
540  pFile = fopen (textfilename , "w");
541  if (!pFile){
542  printf("Cannot open output text file\n");
543  std::abort();}
544  } else {
545  if (m_SetPartition){
546  textfilename.Form("BadCellList_%s_run%d.txt",m_LarIdTranslator->GetPartitonLayerName(m_PartitionIndex),runNumber);
547  pFile = fopen (textfilename , "w");
548  if (!pFile){
549  printf("Cannot open output text file\n");
550  std::abort();}
551  }
552  }
553  }
554 
555 
556 
557 
558 printf("Determining mean cell hits...\n ");
559  GetMeanCellHits(inputfile, nlb, lbmin, lbmax, nsigmaHits, BadLBList, MeanHits, rmsHits, nlb_corr);
560 printf("Done.\n");
561 printf("Set threshold at %4.3f counts per cell for LB range. \n",(MeanHits+(nsigmaHits*rmsHits))*((double)nlb_corr-(double)nBadLBs));
562 
563 
564  if (m_SaveTextFile){
565  fprintf(pFile, "onlid // part // FT // SL // CH // Events (E>%d sigma) // Events E>1GeV // Mean Energy [GeV] // # LBs // fraction events Q>%d // Flagged in LB // selectionFlag\n",(int)nsigmaHits,qthreshold);
566  }
567 
568  int EventCount=0., qcount=0.;
569  // ----------------------------------------------------
570  // Prepare output tree listing bad channels
571  // ----------------------------------------------------
572  if (m_SetPartition){
573  rootfilename.Form("Output/BadCells_%s_run%d.root",m_LarIdTranslator->GetPartitonLayerName(m_PartitionIndex),runNumber);
574  } else {
575  rootfilename.Form("Output/BadCells_run%d.root",runNumber);
576  }
577 
578  auto fout = std::make_unique<TFile>(rootfilename,"RECREATE");
579  Int_t larid = 0;
580  Int_t t_run =0;
581  Int_t n_ensig = 0;
582  Int_t n_ecut = 0;
583  Float_t fr_LB = 0;
584  Float_t nbrLB = 0;
585  Float_t noise = 0;
586  Float_t meanECell = 0;
587  Float_t fr_q4k = 0;
588  TH1F* h1_lb = nullptr;
589  TH1F* h1_e = nullptr;
590  TH1F* h1_q = nullptr;
591  TH2F* h2_elb = nullptr;
592  TH2D* h2_pulse = nullptr;
593  TH2D* h2_t_LB = nullptr;
594  TProfile* TProf_pulse = nullptr;
595  TH1F* h1_ADCmax = nullptr;
596  std::unique_ptr<TTree> tree_cells;
597  if(m_SaveRootFile){
598  tree_cells.reset(new TTree("BadTree","LAr Tree ordered by OnlID"));
599  tree_cells->Branch("Energy",&h1_e);
600  tree_cells->Branch("Quality",&h1_q);
601  tree_cells->Branch("LB",&h1_lb);
602  tree_cells->Branch("larid",&larid);
603  tree_cells->Branch("onlid",&onlid);
604  tree_cells->Branch("Run",&t_run);
605  tree_cells->Branch("selectionFlag",&selectionFlag);
606  tree_cells->Branch("nhits_ensig",&n_ensig);
607  tree_cells->Branch("nhits_e1GeV",&n_ecut);
608  tree_cells->Branch("Quality_4k",&fr_q4k);
609  tree_cells->Branch("LBfraction",&fr_LB);
610  tree_cells->Branch("EnergyVsLB",&h2_elb);
611  tree_cells->Branch("PulseShape",&h2_pulse);
612  tree_cells->Branch("PulsePeakTimeVsLB",&h2_t_LB);
613  tree_cells->Branch("noise",&noise);
614  tree_cells->Branch("MeanCellEnergy",&meanECell);
615  tree_cells->Branch("PulseShapeTProf",&TProf_pulse);
616  tree_cells->Branch("ADCmax",&h1_ADCmax);
617  }
618 
619  Double_t xmin=-4.9,xmax=4.9;
620  Double_t xw=0.1;
621  TH2D NormPulse("Normalised_pulse","",100,-200,200,400,-10,10);
622  NormPulse.SetXTitle("Time [ns]");
623  NormPulse.SetYTitle("Value [ADC counts] / ADCmax");
624  //
625  //THVec, defined at file scope, holds unique_ptr, defined a filescope
626  THVec<TH2D> Pulsemaps(npl);
627  THVec<TH2F> Cellmaps(npl);
628  THVec<TH2F> E_LBmaps(npl);
629  THVec<TH2D> t_LBmaps(npl);
630  THVec<TH1F> CellsFlagged_LB_part(npl);
631  THVec<TH1F> Emean_NbrEvents_part(npl);
632  //
633  TH2F E_LB("E_LB","",nlb,lbmin,lbmax,ne,emin,emax);
634  E_LB.SetXTitle("LB");
635  E_LB.SetYTitle("Energy [GeV]");
636  //
637  TH2D t_LB("t_LB","",nlb,lbmin,lbmax,400,-200,200);
638  t_LB.GetXaxis()->SetTitle("LB");
639  t_LB.GetYaxis()->SetTitle("Time(maxSample) + ofcTime [ns]");
640  //
641  TH1F CF_LB("CF_LB","",nlb,lbmin,lbmax);
642  CF_LB.GetXaxis()->SetTitle("LB");
643  CF_LB.GetYaxis()->SetTitle("Number of cells flagged");
644  //
645  TH1F ME_EV("ME_EV","",1000,0,1000);
646  ME_EV.GetXaxis()->SetTitle("Nbr events >1 GeV");
647  ME_EV.GetYaxis()->SetTitle("Mean Energy [GeV]");
648 
649 
650 
651  if(m_SaveRootFile){
652  for (int ii=0;ii<npl;ii++){
653  Cellmaps[ii].reset((TH2F*)m_LarIdTranslator->GetCaloPartitionLayerMap(ii));
654  Cellmaps[ii]->GetXaxis()->SetTitle("#eta"); Cellmaps[ii]->GetYaxis()->SetTitle("#Phi");
655  hname.Form("%s_PulseShape_%dsigma",m_LarIdTranslator->GetPartitonLayerName(ii),(int)nsigmaHits);
656  Pulsemaps[ii].reset((TH2D*)NormPulse.Clone(hname));
657  hname.Form("%s_EvergyVsLB",m_LarIdTranslator->GetPartitonLayerName(ii));
658  E_LBmaps[ii].reset((TH2F*)E_LB.Clone(hname));
659  hname.Form("%s_PulseTimeVsLB",m_LarIdTranslator->GetPartitonLayerName(ii));
660  t_LBmaps[ii].reset((TH2D*)t_LB.Clone(hname));
661  hname.Form("%s_CellsFlaggedVsLB",m_LarIdTranslator->GetPartitonLayerName(ii));
662  CellsFlagged_LB_part[ii].reset((TH1F*)CF_LB.Clone(hname));
663  // en plus
664  hname.Form("%s_EmeanVsNbrEvents",m_LarIdTranslator->GetPartitonLayerName(ii));
665  Emean_NbrEvents_part[ii].reset((TH1F*)ME_EV.Clone(hname));
666  //
667  }
668  }
669  TH2F Eeta("Eeta","",(int)floor((xmax-xmin)/xw),xmin,xmax,ne,emin,emax);
670  Eeta.GetXaxis()->SetTitle("#eta");
671  Eeta.GetYaxis()->SetTitle("Energy [GeV]");
672  //
673  TH1F CellEnergy("CellEnergy","",ne,emin,emax);
674  CellEnergy.GetXaxis()->SetTitle("Cell Mean Energy [GeV]");
675  CellEnergy.GetYaxis()->SetTitle("Cells");
676  //
677  TH1F LBfrac("LBfrac","",100,0.,1.);
678  LBfrac.GetXaxis()->SetTitle("LB fraction");
679  LBfrac.GetYaxis()->SetTitle("Cells");
680  //
681  TH1F Qfrac("Qfrac","",100.,0.,1.);
682  Qfrac.GetXaxis()->SetTitle("Fraction of Events Q>4000");
683  Qfrac.GetYaxis()->SetTitle("Cells");
684  //
685  TH1F CellsFlagged_LB("CellsFlagged_LB","",nlb,lbmin,lbmax);
686  CellsFlagged_LB.GetXaxis()->SetTitle("LB");
687  CellsFlagged_LB.GetYaxis()->SetTitle("Number of cells flagged");
688  //
689  TH1F Emean_NbrEvents("Emean_NEvents_1GeV","",1000,0,1000);
690  Emean_NbrEvents.GetXaxis()->SetTitle("N events > 1 GeV");
691  Emean_NbrEvents.GetYaxis()->SetTitle("Mean Energy [GeV]");
692  //
693  // -------------------------------------------------------------------------
694  // create individual cell histos
695  // -------------------------------------------------------------------------
696  printf("Creating histograms (nEbins = %d, nQbins = %d, nLBbins = %d)... ",ne,nq,nlb);
697  TH1F hene = TH1F("hEne","",ne,emin,emax); hene.SetXTitle("Energy [GeV]");
698  hene.SetYTitle("Events");
699  TH1F hqua = TH1F("hQua","",nq/100.,qmin,qmax); hqua.SetXTitle("Quality");
700  hqua.SetYTitle("Events");
701  TH1F hlb = TH1F("hLB","",nlb,lbmin,lbmax); hlb.SetXTitle("LB");
702  hlb.SetYTitle("Events");
703  TH2F henelb = TH2F("hEnelb","",nlb,lbmin,lbmax,ne,emin,emax); henelb.SetXTitle("LB");
704  henelb.SetYTitle("Energy [GeV]");
705  TH2D hpulse = TH2D("hPulse","",100,-200,200,400, -10,10); hpulse.SetXTitle("Time [ns]");
706  hpulse.SetYTitle("Value [ADC counts] / ADCmax");
707  TProfile TProfpulse = TProfile("", "",5, 0, 5, "s"); TProfpulse.SetXTitle("Sample Number");
708  TProfpulse.SetYTitle("Value [ADC counts]");
709  TH2D ht_LB= TH2D("ht_LB","",nlb,lbmin,lbmax,400,-200,200); ht_LB.GetXaxis()->SetTitle("LB");
710  ht_LB.GetYaxis()->SetTitle("Time(maxSample) + ofcTime [ns]");
711  TH1F hADCmax = TH1F("","",110,-200,2000); hADCmax.SetXTitle("ADCmax [ADC counts]"); hADCmax.SetYTitle("Events");
712  // -------------------------------------------------------------------------
713  printf("Done.\n");
714 
715  // Opening file:
717  printf("Number of events: %u %u\n",tuple->nEvents(),tuple->nChannels()); //tuple->ShowEvents("energy>0.");
718  unsigned int nchannels = tuple->nChannels();
719 
720  fprintf(outputFile,"Onlid \t MeanCellHitBased \t EnergyThresholdBased \t OR \t AND\n");
721  // -------------------------------------------------------------------------
722 
723  printf("Begin looping over cells...\n");
724  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
725  // pass empty cells
726  if(tuple->historySize(ichan)==0){ nskipped++; continue; }
727 
728 
729  // process non empty cells
730  const LArSamples::History* hist = tuple->cellHistory(ichan);
731  const LArSamples::CellInfo* cellInfo = hist->cellInfo();
732  double eta = cellInfo->eta();
733  double phi = cellInfo->phi();
734 
735 
736  // index for partition
737  index = m_LarIdTranslator->GetPartitionLayerIndex(cellInfo->calo(),cellInfo->layer());
738  onlid = cellInfo->onlid();
739 
740  // if only checking a specific partition, skip any cells not associated with that partition
741  if(m_SetPartition){
742  if (!CheckPartition(index)){ nskipped++; continue; }
743  }
744 
745  // if cell contains less hits that the threshold requirement, skip it
746  unsigned int ndigits = hist->nData();
747  if(ndigits<(unsigned int)threshold){ nskipped++; continue; }
748 
749 
750  // initialise individual cell histograms
752  // set individual cell histos
753  hname.Form("h0x%x_Energy",onlid);
754  h1_e = (TH1F*)hene.Clone(hname);
755  hname.Form("h0x%x_Quality",onlid);
756  h1_q = (TH1F*)hqua.Clone(hname);
757  hname.Form("h0x%x_LB",onlid);
758  h1_lb = (TH1F*)hlb.Clone(hname);
759  hname.Form("h0x%x_Energy_LB",onlid);
760  h2_elb = (TH2F*)henelb.Clone(hname);
761  hname.Form("h0x%x_Pulse",onlid);
762  h2_pulse = (TH2D*)hpulse.Clone(hname);
763  hname.Form("TProf0x%x_Pulse",onlid);
764  TProf_pulse = (TProfile*)TProfpulse.Clone(hname);
765  hname.Form("h0x%x_ADCmax",onlid);
766  h1_ADCmax = (TH1F*)hADCmax.Clone(hname);
767  hname.Form("h0x%x_t_LB",onlid);
768  h2_t_LB = (TH2D*)ht_LB.Clone(hname);
769  }
770 
771  bool CellInList = false;
772  int LBFlaggedIn = -1;
773 
774 // loop on the events for each cell
775  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
776  const LArSamples::Data* data = hist->data(idigit);
777  noise = data->noise()*GeV;
778  const LArSamples::EventData* Evdata = data->eventData();
779  if(!Evdata){ noEvdata++; continue; }// avoid crash
780  int lumiBlock = Evdata->lumiBlock();
781  double energy = data->energy()*GeV;
782 
783  // checks whether or not an event is in a bad LB when the bad LB list is read in manually
784  // @ TODO: Do we still need this functionality? Aren't we always going to read in the list at the merging stage now?
785  bool isBadLB = CheckBadLBList(lumiBlock,BadLBList);
786 
787  // skip bad LBs
788  if (isBadLB) continue;
789 
790  // check the event satisfies selection criteria
791  bool ProcessEvent = CheckEventSelectionCriteria(lumiBlock, nsigmaHits, energy, noise, lbmin, lbmax);
792  if (ProcessEvent){
793 
795  h1_e->Fill(data->energy()*GeV);
796  h1_q->Fill(data->quality());
797  h1_lb->Fill(lumiBlock);
798  h2_elb->Fill(lumiBlock, data->energy()*GeV);
799  h1_ADCmax->Fill(data->adcMax());
800  double time = data->maxPosition()*25.0+data->ofcTime();
801  h2_t_LB->Fill(lumiBlock,time);
802  for(unsigned int isample=0;isample<data->nSamples();isample++) {
803  TProf_pulse->Fill(isample, data->value(isample));
804  h2_pulse->Fill(data->time(isample)-time, data->value(isample)/data->adcMax());
805  }
806  }
807 
808  // count the number of processed events per cell with a bad q-factor
809  if (data->quality() > qthreshold){
810  qcount = qcount+1;
811  }
812 
813  // count the number of events processed per cell
814  EventCount++;
815 
816  // count number of processed events with energy > ecut and calculate cumulative energy
817  if (data->energy()*GeV > ecut) {
818  nEvents_E_gt_ecut++;
819  EventEnergySum+=(data->energy()*GeV);
820  }
821 
822  // if the cell isn't already in the list check whether or not it should be
823  if(!CellInList){
824  selectionFlag=CheckCellSelectionCriteria(EventCount,nsigmaHits,MeanHits,rmsHits,nEvents_E_gt_ecut,EventEnergySum,nBadLBs,nlb_corr);
825  if(selectionFlag==2){
826  LBFlaggedIn = lumiBlock;
827  CellInList = true;
828  }
829  else if(selectionFlag==1){
830  if(m_Algo==2){
831  LBFlaggedIn = lumiBlock;
832  CellInList = true;
833  }
834  else if(m_Algo==0){
835  LBFlaggedIn = lumiBlock;
836  CellInList = true;
837  }
838  }
839  else if(selectionFlag==0){
840  if(m_Algo==2){
841  LBFlaggedIn = lumiBlock;
842  CellInList = true;
843  }
844  else if(m_Algo==1){
845  LBFlaggedIn = lumiBlock;
846  CellInList = true;
847  }
848  }
849  }
850 
851  }
852 
853  } // end of event loop
854 
855  CellCounter++;
856  if ( CellCounter%1000 == 0 ) {
857  printf("Scanning Cell No. = %d\n",CellCounter);
858  }
859  selectionFlag=CheckCellSelectionCriteria(EventCount,nsigmaHits,MeanHits,rmsHits,nEvents_E_gt_ecut,EventEnergySum,nBadLBs,nlb_corr);
860 
861  // check whether or not cell needs to be put in list
862  if (selectionFlag >= 0){
863  bool ListOutput = true;
864  int MeanCellHitsSelection = 0;
865  int EnergyThresholdSelection = 0;
866  int OR_selection = 0;
867  int AND_selection = 0;
868 
869  if (selectionFlag == 2){
870  MeanCellHitsSelection = 1;
871  EnergyThresholdSelection = 1;
872  OR_selection = 1;
873  AND_selection = 1;
874  }
875 
876 
877  else if (selectionFlag == 1){
878  if (m_Algo == 1) ListOutput = false;
879  MeanCellHitsSelection = 1;
880  EnergyThresholdSelection = 0;
881  OR_selection = 1;
882  AND_selection = 0;
883  }
884 
885  else if (selectionFlag == 0){
886  if (m_Algo == 0) ListOutput = false;
887  MeanCellHitsSelection = 0;
888  EnergyThresholdSelection = 1;
889  OR_selection = 1;
890  AND_selection = 0;
891  }
892 
893  // record number of cells selected by each algorithm
894  iMeanCellHitsSelection += MeanCellHitsSelection;
895  iEnergyThresholdSelection += EnergyThresholdSelection;
896  iOR_selection += OR_selection;
897  iAND_selection += AND_selection;
898 
899  // does the cell occur using both algorithms?
900  if (m_SelectRecurringBadCells){ if(AND_selection == 0) ListOutput = false; }
901  if (m_SelectRecurringBadCells){ if(AND_selection == 1) ListOutput = true; }
902 
903  if (ListOutput){
904  fprintf(outputFile,"0x%x \t %d \t \t \t %d \t \t %d \t %d\n",onlid,MeanCellHitsSelection,EnergyThresholdSelection,OR_selection,AND_selection);
905 
906 
907 
908  nBadCells++;
909  if(m_SaveTextFile){
910  int nLB = 0;
911  for (int ilb=1;ilb<=nlb;ilb++){
912  if (h1_lb->GetBinContent(ilb) > 0.) nLB++;
913 
914  }
915  fr_LB = (double)nLB/(double)(nlb_corr-nBadLBs);
916  nbrLB = (double)nLB;
917  meanECell = h1_e->GetMean();
918  n_ensig = EventCount;
919  if (EventCount!=0){
920  fr_q4k = (double)qcount/(double)EventCount;
921  }
922  n_ecut = nEvents_E_gt_ecut;
923  }
924 
925  if (m_SaveRootFile){
926  int nLB = 0;
927  for (int ilb=1;ilb<=nlb;ilb++){
928  if (h1_lb->GetBinContent(ilb) > 0.) nLB++;
929  }
930  fr_LB = (double)nLB/(double)(nlb_corr-nBadLBs);
931  nbrLB = (double)nLB;
932  meanECell = h1_e->GetMean();
933  n_ensig = EventCount;
934  if (EventCount!=0){
935  fr_q4k = (double)qcount/(double)EventCount;
936  }
937  n_ecut = nEvents_E_gt_ecut;
938  Cellmaps[index]->Fill(eta,phi,meanECell);
939  Eeta.Fill(eta,meanECell);
940  CellEnergy.Fill(meanECell);
941  LBfrac.Fill(fr_LB);
942  if (n_ecut>0) {
943  Emean_NbrEvents.Fill(n_ecut,EventEnergySum/n_ecut);
944  Emean_NbrEvents_part[index]->Fill(n_ecut,EventEnergySum/n_ecut);
945  }
946 
947  Qfrac.Fill(fr_q4k);
948  Pulsemaps[index]->Add(Pulsemaps[index].get(),h2_pulse);
949  E_LBmaps[index]->Add(E_LBmaps[index].get(),h2_elb);
950  t_LBmaps[index]->Add(t_LBmaps[index].get(),h2_t_LB);
951  CellsFlagged_LB_part[index]->Fill(LBFlaggedIn);
952  CellsFlagged_LB.Fill(LBFlaggedIn);
953  }
954 
955  if (m_SaveRootTree){ tree_cells->Fill(); }
956 
957 
958 
959  if (m_SaveTextFile){
960  if (nEvents_E_gt_ecut>0) { EventEnergyMean = EventEnergySum/nEvents_E_gt_ecut; }
961  fprintf(pFile, "0x%x \t %7s \t %d \t %d \t %d \t %d \t %d \t %f \t %4.0f \t %4.3f \t %d \t %d\n",onlid,m_LarIdTranslator->GetPartitonLayerName(index),cellInfo->feedThrough(),cellInfo->slot(),cellInfo->channel(),EventCount,nEvents_E_gt_ecut,EventEnergyMean,nbrLB,fr_q4k,LBFlaggedIn,selectionFlag);
962 
963  }
964 
965  }
966  }
967 
968  qcount = 0.;
969  EventCount = 0.;
970  nEvents_E_gt_ecut = 0.;
971  EventEnergySum = 0.;
972  EventEnergyMean = 0.;
973  } // end of cell loop
974  printf("Cells selected: MeanCellHitsCut \t EnergyThreshodCut \t Either List \t Both Lists\n");
975  printf("\t \t %d \t \t \t \t %d \t \t %d \t %d\n",iMeanCellHitsSelection,iEnergyThresholdSelection,iOR_selection,iAND_selection);
976  if (m_SaveTextFile){
977  fclose (pFile);
978  }
979  fclose (outputFile);
980 
981  int nbad = m_nexpected-nskipped;
982  printf("Skipped %d cells. Cells scanned = %d\n",nskipped,nbad);
983  printf("Cells put in Bad Cell List = %d\n",nBadCells);
984  if (noEvdata>0) printf("No Evdata pointer: %d\n",noEvdata);
985 
986  if(m_SaveRootFile){
987  fout->cd();
988  for(int i=0;i<npl;i++){
989  if(Cellmaps[i]->GetEntries()>0) Cellmaps[i]->Write();
990  if(E_LBmaps[i]->GetEntries()>0) E_LBmaps[i]->Write();
991  if(t_LBmaps[i]->GetEntries()>0) t_LBmaps[i]->Write();
992  if(Pulsemaps[i]->GetEntries()>0) Pulsemaps[i]->Write();
993  if(CellsFlagged_LB_part[i]->GetEntries()>0) CellsFlagged_LB_part[i]->Write();
994  if( Emean_NbrEvents_part[i]->GetEntries()>0) Emean_NbrEvents_part[i]->Write();
995  }
996  CellsFlagged_LB.Write();
997  Eeta.Write();
998  CellEnergy.Write();
999  Qfrac.Write();
1000  Emean_NbrEvents.Write();
1001  LBfrac.Write();
1002  }
1003  fout->Close();
1004  delete h1_lb;
1005  delete h1_e;
1006  delete h1_q;
1007  delete h2_elb;
1008  delete h2_pulse;
1009  delete h2_t_LB;
1010  delete TProf_pulse;
1011  delete h1_ADCmax;
1012  return;
1013 
1014 }

◆ ScanOnlids()

void LArCellsEmptyMonitoring::ScanOnlids ( const TString &  inputfile)

Definition at line 1505 of file LArCellsEmptyMonitoring.cxx.

1506 {
1507  // Scans all channel entries in the ntuple and looks for duplicates onlids.
1508 
1509  int index = -1;
1510  ULong64_t onlid = 0;
1511  std::map<ULong64_t,unsigned int> idmap;
1513  int nskipped=0,nrepeated=0;
1514 
1515  // Opening file:
1516  std::unique_ptr<LArSamples::Interface> tuple((LArSamples::Interface*)Interface::open(inputfile));
1517  printf("Number of events: %u %u\n",tuple->nEvents(),tuple->nChannels()); //tuple->ShowEvents("energy>0.");
1518  unsigned int nchannels = tuple->nChannels();
1519 
1520  // -------------------------------------------------------------------------
1521  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1522  // pass empty cells
1523  if(tuple->historySize(ichan)==0){ nskipped++; continue; }
1524 
1525  // process non empty cells
1526  const LArSamples::History* hist = tuple->cellHistory(ichan);
1527  const LArSamples::CellInfo* cellInfo = hist->cellInfo();
1528 
1529  // index for partition
1530  index = m_LarIdTranslator->GetPartitionLayerIndex(cellInfo->calo(),cellInfo->layer());
1531  onlid = cellInfo->onlid();
1532  /*
1533  if(m_LarIdTranslator->FindChannel(index,cellInfo->eta(),cellInfo->phi())){
1534  onlid = m_LarIdTranslator->onlid;
1535  } else onlid = 0;
1536  */
1537  if(onlid<=0) printf("%u: Bad Cell Onlid = 0x%x (%+.2f,%+.2f)\n",ichan,(unsigned int)onlid,cellInfo->eta(),cellInfo->phi());
1538 
1539  idmap_itr = idmap.find(onlid);
1540 
1541  // new onlid
1542  if(idmap_itr == idmap.end()){
1543  idmap[onlid] = ichan;
1544  } else {
1545  nrepeated+=1;
1546  printf("Onlid 0x%x (%d,%s,%+.2f,%+.2f)\n",(unsigned int)onlid,index,m_LarIdTranslator->GetPartitonLayerName(index),
1548  }
1549  }
1550 
1551  printf("Skipped %d cells.\n",nskipped);
1552  printf("Number of onlids: Unique=%d, Repeated=%d\n",(int)idmap.size(),nrepeated);
1553 
1554  return;
1555 }

◆ SetAlgo()

void LArSamples::LArCellsEmptyMonitoring::SetAlgo ( int  algoindex = 2)
inline

Definition at line 55 of file LArCellsEmptyMonitoring.h.

55 { m_Algo = algoindex; }

◆ SetBadLBRemovalOption()

void LArSamples::LArCellsEmptyMonitoring::SetBadLBRemovalOption ( bool  removeLB = true)
inline

Definition at line 62 of file LArCellsEmptyMonitoring.h.

62 { m_RemoveBadLB = removeLB; }

◆ SetCaloMask()

void LArSamples::LArCellsEmptyMonitoring::SetCaloMask ( bool  calo = false)
inline

Definition at line 73 of file LArCellsEmptyMonitoring.h.

73 { m_MaskCalo = calo; }

◆ SetEnergyCountThresholds()

void LArSamples::LArCellsEmptyMonitoring::SetEnergyCountThresholds ( double  ecut = 1.,
int  counts1 = 250,
double  enecell1 = 1.5,
int  counts2 = 25,
double  enecell2 = 30 
)
inline

Definition at line 65 of file LArCellsEmptyMonitoring.h.

65  {
66  m_Ethreshold = ecut;
67  m_UpperCountThreshold = counts1;
68  m_LowerCountThreshold = counts2;
69  m_LowerCellEnergyThreshold = enecell1;
70  m_UpperCellEnergyThreshold = enecell2;
71  }

◆ SetLumiblockRange()

void LArSamples::LArCellsEmptyMonitoring::SetLumiblockRange ( bool  inputRange = false,
int  input_lbmin = 0,
int  input_lbmax = 0 
)
inline

Definition at line 57 of file LArCellsEmptyMonitoring.h.

57  {
58  m_SetLumiblockRange = inputRange;
59  m_input_lbmin = input_lbmin;
60  m_input_lbmax = input_lbmax;
61  }

◆ SetNoiseNsigma()

void LArSamples::LArCellsEmptyMonitoring::SetNoiseNsigma ( double  nsig = 10.)
inline

Definition at line 64 of file LArCellsEmptyMonitoring.h.

64 { m_nsigma = nsig; }

◆ SetNsigmaHitsFromMean()

void LArSamples::LArCellsEmptyMonitoring::SetNsigmaHitsFromMean ( double  nsigmahits = 10.)
inline

Definition at line 56 of file LArCellsEmptyMonitoring.h.

56 { m_nsigmaHits = nsigmahits; }

◆ SetPartition()

void LArCellsEmptyMonitoring::SetPartition ( bool  setpart,
const std::string &  partname 
)

Definition at line 1390 of file LArCellsEmptyMonitoring.cxx.

1391 {
1392  const int npl = m_LarIdTranslator->GetNpl();
1393 
1394  m_SetPartition = setpart;
1395 
1396  if(!setpart)
1397  {
1398  m_PartitionName = "";
1399  m_PartitionIndex = -1;
1400  }
1401  else if(setpart)
1402  {
1403  bool isFoundPartition = false;
1404  for(int i=0; i< npl; i++){
1405  if(partname == m_LarIdTranslator->GetPartitonLayerName(i)){
1406  m_PartitionName = "_" +partname;
1407  m_PartitionIndex = i;
1408  isFoundPartition = true;
1409  }
1410  }
1411  if(!isFoundPartition){
1412  printf("ERROR: Partition %s does not exist! Invalid input name.\n",partname.c_str());
1413  printf("Possible candidates are:\n");
1414  for (int j=0;j<npl;j++){ printf("%s\n",m_LarIdTranslator->GetPartitonLayerName(j)); }
1415  std::abort();
1416  }
1417  }
1418 }

◆ SetPresamplerMask()

void LArSamples::LArCellsEmptyMonitoring::SetPresamplerMask ( bool  PS = false)
inline

Definition at line 72 of file LArCellsEmptyMonitoring.h.

72 { m_MaskPresampler = PS; }

◆ SetQthreshold()

void LArSamples::LArCellsEmptyMonitoring::SetQthreshold ( int  qvalue = 4000)
inline

Definition at line 63 of file LArCellsEmptyMonitoring.h.

63 { m_Qthreshold = qvalue; }

◆ SetSaveRootFile()

void LArSamples::LArCellsEmptyMonitoring::SetSaveRootFile ( bool  flag = false)
inline

Definition at line 51 of file LArCellsEmptyMonitoring.h.

51 { m_SaveRootFile = flag; }

◆ SetSaveRootTree()

void LArSamples::LArCellsEmptyMonitoring::SetSaveRootTree ( bool  flag = false)
inline

Definition at line 52 of file LArCellsEmptyMonitoring.h.

52 { m_SaveRootTree = flag; }

◆ SetSaveTextFile()

void LArSamples::LArCellsEmptyMonitoring::SetSaveTextFile ( bool  flag = false)
inline

Definition at line 53 of file LArCellsEmptyMonitoring.h.

53 { m_SaveTextFile = flag; }

◆ SetSelectRecurringBadCells()

void LArSamples::LArCellsEmptyMonitoring::SetSelectRecurringBadCells ( bool  flag = false)
inline

Definition at line 54 of file LArCellsEmptyMonitoring.h.

◆ TestRun() [1/2]

void LArSamples::LArCellsEmptyMonitoring::TestRun ( const char *  inputfile)
inline

Definition at line 35 of file LArCellsEmptyMonitoring.h.

35 { TString str(inputfile); Run(str); } // wrapper

◆ TestRun() [2/2]

void LArCellsEmptyMonitoring::TestRun ( const TString &  inputfile)

Definition at line 95 of file LArCellsEmptyMonitoring.cxx.

96 {
97 
98  TString htitle,hname,textfilename,rootfilename;
99  //define cumulative energy cuts here (in GeV)
100  double Ecum_cut_PS = 20.;
101  double Ecum_cut_calo = 10.;
102 
103  // define other constants and counters
104  const double GeV = 1/1000.;
105  int index = 0;
106  double nsigmaHits = 10.;
107  const int threshold = 1.;
108  const int qthreshold = m_Qthreshold;
109  int nskipped=0;
110  int nBadCells=0;
111  int noEvdata=0;
112  unsigned int onlid = 0;
113  int ne=0;
114  int emin=0;
115  int emax=0;
116  int nq=0;
117  int qmin=0;
118  int qmax=0;
119  int nlb=0;
120  int lbmin=0;
121  int lbmax=0;
122  int runNumber=0;
123  double MeanEventEnergy_max = -999;
124  double MeanEventEnergy_min = 999;
125 
126  int CellCounter=0;
127 
128 
129  // Deal with bad LBs
130  // @ TODO: Do we still need this option? Not if we are always reading in the defect list at merging...?
131  vector<int, std::allocator<int> > DQLBList;
132  // placeholder
133  vector<int, std::allocator<int> > BadLBList;
134 
135  // find minimum and maximum LB, cell energy, q factor...
136  printf("Getting histogram limits... ");
137  GetLimits_EqLB(inputfile,lbmin,lbmax,emin,emax,qmin,qmax,runNumber,BadLBList);
138  if (m_SetLumiblockRange){
141  }
142  nlb=lbmax-lbmin;
143  ne=emax-emin;
144  nq=qmax-qmin;
145  printf("Done.\n LBmin: %d LBmax: %d Emin: %d Emax: %d Qmin: %d Qmax: %d\n",lbmin,lbmax,emin,emax,qmin,qmax);
146 
147 
148  // Declare and open output textfile
149  FILE * pFile=nullptr;
150  if (m_SaveTextFile){
151  if (!m_SetPartition){
152  textfilename.Form("Output/BadCellList_run%d.txt",runNumber);
153  pFile = fopen (textfilename , "w");
154  if (!pFile){
155  printf("Cannot open output text file\n");
156  std::abort();}
157  } else {
158  // placeholder - in case someone wants to look at individual partitions only!
159  if (m_SetPartition){
160  textfilename.Form("Output/BadCellList_%s_run%d.txt",m_LarIdTranslator->GetPartitonLayerName(m_PartitionIndex),runNumber);
161  pFile = fopen (textfilename , "w");
162  if (!pFile){
163  printf("Cannot open output text file\n");
164  std::abort();}
165  }
166  }
167  }
168  // Open output text file to write column titles
169  if (m_SaveTextFile){
170  fprintf(pFile, "onlid // part // FT // SL // CH // # Events E>%d sigma // Mean Event Energy [GeV] (min // max) // # LBs // # LBs affected // fraction events Q>%d \n",(int)nsigmaHits,qthreshold);
171  }
172 
173  int EventCount=0., qcount=0.;
174 
175  // Declare root file (LAr investigations - not intended to be produced by default)
176  if (m_SetPartition){
177  rootfilename.Form("Output/BadCells_%s_run%d.root",m_LarIdTranslator->GetPartitonLayerName(m_PartitionIndex),runNumber);
178  } else {
179  rootfilename.Form("Output/BadCells_run%d.root",runNumber);
180  }
181 
182  auto fout = std::make_unique<TFile>(rootfilename,"RECREATE");
183  Float_t noise = 0;
184  Float_t fr_q4k = 0;
185  TH1Fp h1_lb;
186  TH1Fp h1_elb;
187  TH1Fp h1_qlb;
188  TH1Fp h1_e;
189  TH1Fp h1_q;
190  TH2Fp h2_elb;
191 
192 
193  // -------------------------------------------------------------------------
194  // create individual cell histos
195  // -------------------------------------------------------------------------
196  printf("Creating histograms (nEbins = %d, nQbins = %d, nLBbins = %d)... ",ne,nq,nlb);
197  TH1F hene = TH1F("hEne","",ne,emin,emax); hene.SetXTitle("Energy [GeV]"); hene.SetYTitle("Events");
198  TH1F hqua = TH1F("hQua","",nq/100.,qmin,qmax); hqua.SetXTitle("Quality"); hqua.SetYTitle("Events");
199  TH1F hlb = TH1F("hLB","",nlb,lbmin,lbmax); hlb.SetXTitle("LB"); hlb.SetYTitle("Events");
200  TH2F henelb = TH2F("hEnelb","",nlb,lbmin,lbmax,ne,emin,emax); henelb.SetXTitle("LB"); henelb.SetYTitle("Energy [GeV]");
201  // -------------------------------------------------------------------------
202  printf("Done.\n");
203 
204  // -------------------------------------------------------------------------
205  // New test histos:
206  // -------------------------------------------------------------------------
207  printf("Creating cut test histograms...");
208  static constexpr int npl=4;
209  TH2F tempHist = TH2F("tempNEvLB","",1000,0,1000.,1000,0.,1000.);
210  //THArray, defined at file scope, holds unique_ptr
211  THArray<TH1F, npl> hNoise{};
212  THArray<TH1F, npl> hCellsPerLB{};
213  THArray<TH2F, npl> hNEvVsEMean{};
214  THArray<TH2F, npl> hNEvVsECum{};
215  THArray<TH2F, npl> hECumVsEMean{};
216 
217  for (int i=0;i<npl;i++){
218  hname.Form("hNEvVsEMean_Layer%i",i);
219  hNEvVsEMean[i].reset((TH2F*)tempHist.Clone(hname));
220  hNEvVsEMean[i]->GetXaxis()->SetTitle("Number of Events (E > 10 #sigma) / LB");
221  hNEvVsEMean[i]->GetYaxis()->SetTitle("E_{mean} per Event / LB [GeV]");
222 
223  hname.Form("hNEvVsECum_Layer%i",i);
224  hNEvVsECum[i].reset((TH2F*)tempHist.Clone(hname));
225  hNEvVsECum[i]->GetXaxis()->SetTitle("Number of Events (E > 10 #sigma) / LB");
226  hNEvVsECum[i]->GetYaxis()->SetTitle("E_{cumulative} per Cell / LB [GeV]");
227 
228  hname.Form("hECumVsEMean_Layer%i",i);
229  hECumVsEMean[i].reset((TH2F*)tempHist.Clone(hname));
230  hECumVsEMean[i]->GetXaxis()->SetTitle("E_{cumulative} per Cell / LB [GeV]");
231  hECumVsEMean[i]->GetYaxis()->SetTitle("E_{mean} per Event / LB [GeV]");
232 
233  hname.Form("hNoise_Layer%i",i);
234  hNoise[i].reset(new TH1F(hname,"",60,0.,30.));
235  hNoise[i]->GetXaxis()->SetTitle("Noise [GeV]");
236  hNoise[i]->GetYaxis()->SetTitle("Number Of Cells");
237 
238  hname.Form("hCellsPerLB_Layer%i",i);
239  hCellsPerLB[i].reset((TH1F*)hlb.Clone(hname));
240  hCellsPerLB[i]->GetXaxis()->SetTitle("LB");
241  hNoise[i]->GetYaxis()->SetTitle("Number Of Cells");
242  }
243  printf("Done\n");
244  // -------------------------------------------------------------------------
245 
246 
247  // Opening file:
248  std::unique_ptr<LArSamples::Interface> tuple ((LArSamples::Interface*)Interface::open(inputfile));
249  printf("Number of events: %u %u\n",tuple->nEvents(),tuple->nChannels());
250  unsigned int nchannels = tuple->nChannels();
251 
252  printf("Begin looping over cells...\n");
253  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
254 
255  // pass empty cells
256  if(tuple->historySize(ichan)==0){ nskipped++; continue; }
257 
258  // process non empty cells
259  const LArSamples::History* hist = tuple->cellHistory(ichan);
260  const LArSamples::CellInfo* cellInfo = hist->cellInfo();
261 
262  // index for partition
263  index = m_LarIdTranslator->GetPartitionLayerIndex(cellInfo->calo(),cellInfo->layer());
264  onlid = cellInfo->onlid();
265 
266  // if cell contains less hits than the threshold requirement, skip it
267  unsigned int ndigits = hist->nData();
268  if(ndigits<(unsigned int)threshold){ nskipped++; continue; }
269 
271  // set individual cell histos
272  hname.Form("h0x%x_Energy",onlid);
273  h1_e.reset((TH1F*)hene.Clone(hname));
274  hname.Form("h0x%x_Quality",onlid);
275  h1_q.reset((TH1F*)hqua.Clone(hname));
276  hname.Form("h0x%x_LB",onlid);
277  h1_lb.reset((TH1F*)hlb.Clone(hname));
278  hname.Form("h0x%x_hNEvVsEMean",onlid);
279  h1_elb.reset((TH1F*)hlb.Clone(hname));
280  hname.Form("h0x%x_Energy_LB",onlid);
281  h2_elb.reset((TH2F*)henelb.Clone(hname));
282  hname.Form("h0x%x_Quality_LB",onlid);
283  h1_qlb.reset((TH1F*)hlb.Clone(hname));
284  }
285 
286  // loop on the events for each cell
287  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
288  const LArSamples::Data* data = hist->data(idigit);
289  double noise = data->noise()*GeV;
290  const LArSamples::EventData* Evdata = data->eventData();
291  if(!Evdata){ noEvdata++; continue; }// avoid crash
292  int lumiBlock = Evdata->lumiBlock();
293  double energy = data->energy()*GeV;
294 
295  if (energy > nsigmaHits*noise){ // E>10sigma
296 
297  // Fill individual cell histos
299  h1_e->Fill(energy);
300  h1_q->Fill(data->quality());
301  h1_lb->Fill(lumiBlock);
302  h1_elb->Fill(lumiBlock, energy);
303  h2_elb->Fill(lumiBlock, energy);
304  h1_qlb->Fill(lumiBlock, data->quality());
305  }
306 
307  // count the number of processed events per cell with a bad q-factor
308  if (data->quality() > qthreshold){
309  qcount = qcount+1;
310  }
311 
312  // count the number of events processed per cell
313  EventCount++;
314 
315  } // end of E>10sigma
316 
317  } // end of event loop
319  hNoise[cellInfo->layer()]->Fill(noise);
320  }
321  CellCounter++;
322  if ( CellCounter%1000 == 0 ) {
323  printf("Scanning Cell No. = %d\n",CellCounter);
324  }
325  MeanEventEnergy_max = -999;
326  MeanEventEnergy_min = 999;
327  bool FlagCell=false;
328  int FlagCount=0;
329  int NFullLB = 0;
330 
332  for (int ilb=1;ilb<=nlb;ilb++){
333  if (h1_lb->GetBinContent(ilb) > 0.){
334  double EtotInLB = h1_elb->GetBinContent(ilb);
335  double NEventsInLB = h1_lb->GetBinContent(ilb);
336  //double MeanQ = h1_qlb->GetBinContent(ilb) / NEventsInLB; // change to fraction..
337  int LB_number = h1_lb->GetBinLowEdge(ilb);
338  NFullLB += 1;
339  double MeanEventEnergy = EtotInLB / NEventsInLB;
340 
341 
342  if (cellInfo->layer()==0){
343  if (EtotInLB>Ecum_cut_PS){
344  hNEvVsEMean[cellInfo->layer()]->Fill(NEventsInLB,MeanEventEnergy);
345  hNEvVsECum[cellInfo->layer()]->Fill(NEventsInLB,EtotInLB);
346  hECumVsEMean[cellInfo->layer()]->Fill(EtotInLB,MeanEventEnergy);
347  hCellsPerLB[cellInfo->layer()]->Fill(LB_number);
348  }
349  }
350  else if (EtotInLB>Ecum_cut_calo){
351  hNEvVsEMean[cellInfo->layer()]->Fill(NEventsInLB,MeanEventEnergy);
352  hNEvVsECum[cellInfo->layer()]->Fill(NEventsInLB,EtotInLB);
353  hECumVsEMean[cellInfo->layer()]->Fill(EtotInLB,MeanEventEnergy);
354  hCellsPerLB[cellInfo->layer()]->Fill(LB_number);
355  }
356 
357  if (EtotInLB>Ecum_cut_PS && cellInfo->layer()==0){
358  FlagCell=true; FlagCount++;
359  if (MeanEventEnergy_max<MeanEventEnergy){ MeanEventEnergy_max = MeanEventEnergy; }
360  if (MeanEventEnergy_min>MeanEventEnergy){ MeanEventEnergy_min = MeanEventEnergy; }
361  }
362  else if (EtotInLB>Ecum_cut_calo && cellInfo->layer()==1){
363  FlagCell=true; FlagCount++;
364  if (MeanEventEnergy_max<MeanEventEnergy){ MeanEventEnergy_max = MeanEventEnergy; }
365  if (MeanEventEnergy_min>MeanEventEnergy){ MeanEventEnergy_min = MeanEventEnergy; }
366  }
367  else if (EtotInLB>Ecum_cut_calo && cellInfo->layer()==2){
368  FlagCell=true; FlagCount++;
369  if (MeanEventEnergy_max<MeanEventEnergy){ MeanEventEnergy_max = MeanEventEnergy; }
370  if (MeanEventEnergy_min>MeanEventEnergy){ MeanEventEnergy_min = MeanEventEnergy; }
371  }
372  else if (EtotInLB>Ecum_cut_calo && cellInfo->layer()==3){
373  FlagCell=true; FlagCount++;
374  if (MeanEventEnergy_max<MeanEventEnergy){ MeanEventEnergy_max = MeanEventEnergy; }
375  if (MeanEventEnergy_min>MeanEventEnergy){ MeanEventEnergy_min = MeanEventEnergy; }
376  }
377  }
378  }
379  if (EventCount!=0){
380  fr_q4k = (double)qcount/(double)EventCount;
381  }
382  }
383  // Write bad channel quantities to text file
384  if (m_SaveTextFile){
385  if (FlagCell){
386  nBadCells++;
387  fprintf(pFile, "0x%x \t %7s \t %d \t %d \t %d \t %d \t %4.3f \t %4.3f \t %d \t %d \t %4.3f \n",onlid,m_LarIdTranslator->GetPartitonLayerName(index),cellInfo->feedThrough(),cellInfo->slot(),cellInfo->channel(),EventCount,MeanEventEnergy_min,MeanEventEnergy_max,NFullLB,FlagCount,fr_q4k);
388 
389  }
390  }
391 
392  qcount = 0.;
393  EventCount = 0.;
394  } // end of cell loop
395 
396  int nbad = m_nexpected-nskipped;
397  printf("Skipped %d cells. Cells scanned = %d\n",nskipped,nbad);
398  printf("Cells put in Bad Cell List = %d\n",nBadCells);
399  if (noEvdata>0) printf("No Evdata pointer: %d\n",noEvdata);
400 
401  // Write test histos to output rootfile
402  if(m_SaveRootFile){
403  fout->cd();
404  for(int i=0;i<npl;i++){
405  hNEvVsEMean[i]->Write();
406  hNEvVsECum[i]->Write();
407  hECumVsEMean[i]->Write();
408  hNoise[i]->Write();
409  hCellsPerLB[i]->Write();
410  }
411  }
412 
413  fout->Close();
414  fclose(pFile);
415  return;
416 
417 }

◆ TriggerEfficiency()

void LArCellsEmptyMonitoring::TriggerEfficiency ( const char *  inputfile,
float  fractionInPS = 0.8 
)

Definition at line 1710 of file LArCellsEmptyMonitoring.cxx.

1711 {
1712  // Function aimed at extracting the trigger performance of a specific chain
1713  // by emulating its online selection using the calibration stream data.
1714  //
1715  // This is currently used to monitor the rejection performance of the
1716  // PreSampler noise in the physics_CosmicCalo stream (L2_PreS* chains)
1717  // which runs on each family of triggers (EM,TAU,J).
1718  // One needs to set the fraction of energy deposited in the PreSampler with
1719  // fractionInPS.
1720  //
1721 
1722 
1723  std::map< std::pair<unsigned int, unsigned int>, unsigned int > eventCells;
1724  std::map< std::pair<unsigned int, unsigned int>, double > eventEnergy_PS;
1725  std::map< std::pair<unsigned int, unsigned int>, double > eventEnergy_LAr;
1726  std::map< std::pair<unsigned int, unsigned int>, unsigned int > eventCells_PS;
1727  std::map< std::pair<unsigned int, unsigned int>, unsigned int > eventLayer;
1728  int run=0;
1729  // Opening file:
1730  std::unique_ptr<LArSamples::Interface> tuple((LArSamples::Interface*)Interface::open(inputfile));
1731  unsigned int nchannels = tuple->nChannels();
1732 
1733  // -------------------------------------------------------------------------
1734  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1735  // pass empty cells
1736  if(tuple->historySize(ichan)==0){ continue; }
1737 
1738  // process non empty cells
1739  const LArSamples::History* hist = tuple->cellHistory(ichan);
1740  const LArSamples::CellInfo* cellInfo = hist->cellInfo();
1741  unsigned int layer = cellInfo->layer();
1742 
1743  unsigned int ndigits = hist->nData();
1744  if(ndigits==0){ continue; }
1745 
1746  // loop on the events for each cells
1747  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
1748  const LArSamples::Data* data = hist->data(idigit);
1749  run = data->run();
1750 
1751  // convert to GeV
1752  double energyGeV = data->energy()/1000.;
1753 
1754  // cell-event mapping
1755  std::pair<unsigned int, unsigned int> ev(data->run(), data->event());
1756  eventCells[ev]++;
1757  eventEnergy_LAr[ev] += energyGeV;
1758  eventLayer[ev] = layer;
1759  if(layer == 0){
1760  eventEnergy_PS[ev] += energyGeV;
1761  eventCells_PS[ev]++;
1762  }
1763  }
1764  }
1765 
1766  // non-constant binning for a wider spetrum
1767  //double binE[48]={0,2,4,6,8,10,13,16,19,22,26,30,34,38,42,47,52,57,62,68,75,82,90,100,110,120,130,140,150,160,170,180,195,210,225,240,255,270,285,300,320,340,360,380,400,430,460,500};
1768 
1769  constexpr int nbins = 42;
1770  double binE[nbins+1]{};
1771  int i=0,j=0;
1772  int stop=0;
1773  double de = 0.,ene = 0.;
1774  // steps of 2GeV for the first 10 bins [0-20]
1775  de = 2.;
1776  stop = (int)(20./de);
1777  for(i=0;i<stop;i++,j++){
1778  ene = de*(double)i;
1779  binE[j] = ene;
1780  }
1781  // steps of 5GeV for [20-100]
1782  de = 5.;
1783  stop = (int)((100.-20.)/de);
1784  for(i=0;i<stop;i++,j++){
1785  ene += de;
1786  binE[j] = ene;
1787  }
1788  // steps of 25GeV for [100-500]
1789  de = 25.;
1790  stop = (int)((500.-100.)/de);
1791  for(i=0;i<stop;i++,j++){
1792  ene += de;
1793  binE[j] = ene;
1794  }
1795  // add extra bin to cover the rest
1796  binE[j] = 3500.;
1797 
1798 
1799  TH1F E_LAr_pass("E_LAr_pass","",nbins,binE);
1800  TH1F E_LAr_tot("E_LAr_tot","",nbins,binE);
1801  TH1F E_LAr_EM5_pass("E_LAr_EM5_pass","",nbins,binE);
1802  TH1F E_LAr_EM5_tot("E_LAr_EM5_tot","",nbins,binE);
1803  TH1F E_LAr_TAU8_pass("E_LAr_TAU8_pass","",nbins,binE);
1804  TH1F E_LAr_TAU8_tot("E_LAr_TAU8_tot","",nbins,binE);
1805  TH1F E_LAr_J10_pass("E_LAr_J10_pass","",nbins,binE);
1806  TH1F E_LAr_J10_tot("E_LAr_J10_tot","",nbins,binE);
1807  TH1F nCellsPS_pass("nCellsPS_pass","",100, 0, 100);
1808  TH1F nCellsPS_tot("nCellsPS_tot","",100, 0, 100);
1809  TH1F nCellsPS_EM5_pass("nCellsPS_EM5_pass","",100, 0, 100);
1810  TH1F nCellsPS_EM5_tot("nCellsPS_EM5_tot","",100, 0, 100);
1811  TH1F nCellsPS_TAU8_pass("nCellsPS_TAU8_pass","",100, 0, 100);
1812  TH1F nCellsPS_TAU8_tot("nCellsPS_TAU8_tot","",100, 0, 100);
1813  TH1F nCellsPS_J10_tot("nCellsPS_J10_tot","",100, 0, 100);
1814  TH1F nCellsPS_J10_pass("nCellsPS_J10_pass","",100, 0, 100);
1815 
1816  // -------------------------------------------------------------------------
1817  // loop over events (based on Interface::ShowEvents).
1818  // -------------------------------------------------------------------------
1819  for(unsigned int ievent = 0; ievent < tuple->nEvents(); ievent++) {
1820  const LArSamples::EventData* evtData = tuple->eventData(ievent);
1821  std::pair<unsigned int, unsigned int> id(evtData->run(), evtData->event());
1822  if(eventCells[id]==0) continue;
1823  if(eventEnergy_LAr[id]<=0) continue;
1824  bool isEM5 = evtData->isPassed("L1_EM5_EMPTY");
1825  bool isTAU8 = evtData->isPassed("L1_TAU8_EMPTY");
1826  bool isJ10 = evtData->isPassed("L1_J10_EMPTY");
1827 
1828  E_LAr_tot.Fill(eventEnergy_LAr[id]);
1829  nCellsPS_tot.Fill(eventCells_PS[id]);
1830  if(isEM5){
1831  E_LAr_EM5_tot.Fill(eventEnergy_LAr[id]);
1832  nCellsPS_EM5_tot.Fill(eventCells_PS[id]);
1833  }
1834  if(isTAU8){
1835  E_LAr_TAU8_tot.Fill(eventEnergy_LAr[id]);
1836  nCellsPS_TAU8_tot.Fill(eventCells_PS[id]);
1837  }
1838  if(isJ10){
1839  E_LAr_J10_tot.Fill(eventEnergy_LAr[id]);
1840  nCellsPS_J10_tot.Fill(eventCells_PS[id]);
1841  }
1842 
1843  double ratio = 0;
1844  if((eventEnergy_LAr[id])!=0)
1845  ratio = eventEnergy_PS[id]/(eventEnergy_LAr[id]);
1846  bool isL2_PreS = false;
1847  if(ratio > fractionInPS) isL2_PreS = true;
1848 
1849  if(isL2_PreS){
1850  E_LAr_pass.Fill(eventEnergy_LAr[id]);
1851  nCellsPS_pass.Fill(eventCells_PS[id]);
1852  if(isEM5){
1853  E_LAr_EM5_pass.Fill(eventEnergy_LAr[id]);
1854  nCellsPS_EM5_pass.Fill(eventCells_PS[id]);
1855  }
1856  if(isTAU8){
1857  E_LAr_TAU8_pass.Fill(eventEnergy_LAr[id]);
1858  nCellsPS_TAU8_pass.Fill(eventCells_PS[id]);
1859  }
1860  if(isJ10){
1861  E_LAr_J10_pass.Fill(eventEnergy_LAr[id]);
1862  nCellsPS_J10_pass.Fill(eventCells_PS[id]);
1863  }
1864  }
1865  }
1866 
1867  char fname[50]{};
1868  sprintf(fname,"TriggerEfficiency_%d.root",run);
1869  auto mfile = std::make_unique<TFile>(fname,"recreate");
1870  E_LAr_pass.Write();
1871  E_LAr_tot.Write();
1872  E_LAr_EM5_pass.Write();
1873  E_LAr_EM5_tot.Write();
1874  E_LAr_TAU8_pass.Write();
1875  E_LAr_TAU8_tot.Write();
1876  E_LAr_J10_pass.Write();
1877  E_LAr_J10_tot.Write();
1878  nCellsPS_pass.Write();
1879  nCellsPS_tot.Write();
1880  nCellsPS_EM5_pass.Write();
1881  nCellsPS_EM5_tot.Write();
1882  nCellsPS_TAU8_pass.Write();
1883  nCellsPS_TAU8_tot.Write();
1884  nCellsPS_J10_pass.Write();
1885  nCellsPS_J10_tot.Write();
1886 
1887  mfile->Close();
1888 
1889 }

Member Data Documentation

◆ m_Algo

int LArSamples::LArCellsEmptyMonitoring::m_Algo
private

Definition at line 92 of file LArCellsEmptyMonitoring.h.

◆ m_Ethreshold

double LArSamples::LArCellsEmptyMonitoring::m_Ethreshold
private

Definition at line 100 of file LArCellsEmptyMonitoring.h.

◆ m_input_lbmax

int LArSamples::LArCellsEmptyMonitoring::m_input_lbmax
private

Definition at line 95 of file LArCellsEmptyMonitoring.h.

◆ m_input_lbmin

int LArSamples::LArCellsEmptyMonitoring::m_input_lbmin
private

Definition at line 94 of file LArCellsEmptyMonitoring.h.

◆ m_LarIdTranslator

std::unique_ptr<LArIdTranslatorHelper> LArSamples::LArCellsEmptyMonitoring::m_LarIdTranslator
private

Definition at line 84 of file LArCellsEmptyMonitoring.h.

◆ m_LBfile

TString LArSamples::LArCellsEmptyMonitoring::m_LBfile
private

Definition at line 114 of file LArCellsEmptyMonitoring.h.

◆ m_LowerCellEnergyThreshold

double LArSamples::LArCellsEmptyMonitoring::m_LowerCellEnergyThreshold
private

Definition at line 103 of file LArCellsEmptyMonitoring.h.

◆ m_LowerCountThreshold

int LArSamples::LArCellsEmptyMonitoring::m_LowerCountThreshold
private

Definition at line 102 of file LArCellsEmptyMonitoring.h.

◆ m_MaskCalo

bool LArSamples::LArCellsEmptyMonitoring::m_MaskCalo = false
private

Definition at line 106 of file LArCellsEmptyMonitoring.h.

◆ m_MaskPresampler

bool LArSamples::LArCellsEmptyMonitoring::m_MaskPresampler = false
private

Definition at line 105 of file LArCellsEmptyMonitoring.h.

◆ m_Mean_checkBadLBs

double LArSamples::LArCellsEmptyMonitoring::m_Mean_checkBadLBs = 0.0
private

Definition at line 111 of file LArCellsEmptyMonitoring.h.

◆ m_nexpected

int LArSamples::LArCellsEmptyMonitoring::m_nexpected
private

Definition at line 86 of file LArCellsEmptyMonitoring.h.

◆ m_nsigma

double LArSamples::LArCellsEmptyMonitoring::m_nsigma
private

Definition at line 98 of file LArCellsEmptyMonitoring.h.

◆ m_nsigmaHits

double LArSamples::LArCellsEmptyMonitoring::m_nsigmaHits
private

Definition at line 99 of file LArCellsEmptyMonitoring.h.

◆ m_PartitionIndex

int LArSamples::LArCellsEmptyMonitoring::m_PartitionIndex = 0
private

Definition at line 109 of file LArCellsEmptyMonitoring.h.

◆ m_PartitionName

std::string LArSamples::LArCellsEmptyMonitoring::m_PartitionName
private

Definition at line 110 of file LArCellsEmptyMonitoring.h.

◆ m_Qthreshold

int LArSamples::LArCellsEmptyMonitoring::m_Qthreshold
private

Definition at line 97 of file LArCellsEmptyMonitoring.h.

◆ m_ReadDefectLBList

bool LArSamples::LArCellsEmptyMonitoring::m_ReadDefectLBList = false
private

Definition at line 113 of file LArCellsEmptyMonitoring.h.

◆ m_RemoveBadLB

bool LArSamples::LArCellsEmptyMonitoring::m_RemoveBadLB
private

Definition at line 96 of file LArCellsEmptyMonitoring.h.

◆ m_RMS_checkBadLBs

double LArSamples::LArCellsEmptyMonitoring::m_RMS_checkBadLBs = 0.0
private

Definition at line 112 of file LArCellsEmptyMonitoring.h.

◆ m_SaveRootFile

bool LArSamples::LArCellsEmptyMonitoring::m_SaveRootFile
private

Definition at line 89 of file LArCellsEmptyMonitoring.h.

◆ m_SaveRootTree

bool LArSamples::LArCellsEmptyMonitoring::m_SaveRootTree
private

Definition at line 90 of file LArCellsEmptyMonitoring.h.

◆ m_SaveTextFile

bool LArSamples::LArCellsEmptyMonitoring::m_SaveTextFile
private

Definition at line 91 of file LArCellsEmptyMonitoring.h.

◆ m_SelectRecurringBadCells

bool LArSamples::LArCellsEmptyMonitoring::m_SelectRecurringBadCells
private

Definition at line 107 of file LArCellsEmptyMonitoring.h.

◆ m_SetLumiblockRange

bool LArSamples::LArCellsEmptyMonitoring::m_SetLumiblockRange
private

Definition at line 93 of file LArCellsEmptyMonitoring.h.

◆ m_SetPartition

bool LArSamples::LArCellsEmptyMonitoring::m_SetPartition
private

Definition at line 108 of file LArCellsEmptyMonitoring.h.

◆ m_UpperCellEnergyThreshold

double LArSamples::LArCellsEmptyMonitoring::m_UpperCellEnergyThreshold
private

Definition at line 104 of file LArCellsEmptyMonitoring.h.

◆ m_UpperCountThreshold

int LArSamples::LArCellsEmptyMonitoring::m_UpperCountThreshold
private

Definition at line 101 of file LArCellsEmptyMonitoring.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LArSamples::LArCellsEmptyMonitoring::m_LarIdTranslator
std::unique_ptr< LArIdTranslatorHelper > m_LarIdTranslator
Definition: LArCellsEmptyMonitoring.h:84
LArSamples::LArCellsEmptyMonitoring::CheckEventSelectionCriteria
bool CheckEventSelectionCriteria(int lumiBlock, int nsigma, double energy, Float_t noise, int lbmin, int lbmax)
Definition: LArCellsEmptyMonitoring.cxx:1324
LArSamples::LArCellsEmptyMonitoring::m_UpperCountThreshold
int m_UpperCountThreshold
Definition: LArCellsEmptyMonitoring.h:101
LArSamples::LArCellsEmptyMonitoring::m_SaveRootFile
bool m_SaveRootFile
Definition: LArCellsEmptyMonitoring.h:89
LArSamples::LArCellsEmptyMonitoring::m_SetPartition
bool m_SetPartition
Definition: LArCellsEmptyMonitoring.h:108
LArSamples::LArCellsEmptyMonitoring::CheckBadLBList
bool CheckBadLBList(int lumiBlock, const std::vector< int, std::allocator< int > > &BadLBList)
Definition: LArCellsEmptyMonitoring.cxx:1224
extractSporadic.nhists
nhists
Definition: extractSporadic.py:111
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
test_pyathena.eta
eta
Definition: test_pyathena.py:10
LArSamples::LArCellsEmptyMonitoring::GetMeanCellHits
void GetMeanCellHits(const char *inputfile, int nlb, int lbmin, int lbmax, int nsigma, const std::vector< int, std::allocator< int > > &BadLBList, double &MeanHits, double &rmsHits, int &nlb_corr)
Definition: LArCellsEmptyMonitoring.cxx:1234
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
checkFileSG.line
line
Definition: checkFileSG.py:75
LArSamples::CellInfo::slot
short slot() const
Definition: CellInfo.h:68
ReadCellNoiseFromCool.name1
name1
Definition: ReadCellNoiseFromCool.py:233
LArSamples::LArCellsEmptyMonitoring::CheckPartition
bool CheckPartition(int index) const
Definition: LArCellsEmptyMonitoring.cxx:1385
LArSamples::CellInfo::calo
CaloId calo() const
Definition: CellInfo.h:50
run.infile
string infile
Definition: run.py:13
LArSamples::LArCellsEmptyMonitoring::m_Qthreshold
int m_Qthreshold
Definition: LArCellsEmptyMonitoring.h:97
PlotCalibFromCool.yy
yy
Definition: PlotCalibFromCool.py:714
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
LArSamples::EventData::event
int event() const
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/EventData.h:44
LArSamples::LArCellsEmptyMonitoring::m_nsigmaHits
double m_nsigmaHits
Definition: LArCellsEmptyMonitoring.h:99
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:279
LArSamples::LArCellsEmptyMonitoring::CheckCellSelectionCriteria
int CheckCellSelectionCriteria(int EventCount, int nsigmaHits, double MeanHits, double rmsHits, int nEvents_E_gt_ecut, double EventEnergySum, int nBadLBs, int nlb) const
Definition: LArCellsEmptyMonitoring.cxx:1338
index
Definition: index.py:1
plotmaker.hist
hist
Definition: plotmaker.py:148
LArSamples::History
Definition: History.h:35
LArSamples::Interface::nEvents
unsigned int nEvents() const
Definition: Interface.h:51
extractSporadic.c1
c1
Definition: extractSporadic.py:134
checkCorrelInHIST.ilb
ilb
Definition: checkCorrelInHIST.py:563
LArSamples::EventData::isPassed
bool isPassed(const TString &bitName) const
Definition: EventData.cxx:88
LArSamples::CellInfo::feedThrough
short feedThrough() const
Definition: CellInfo.h:65
LArSamples::LArCellsEmptyMonitoring::m_input_lbmin
int m_input_lbmin
Definition: LArCellsEmptyMonitoring.h:94
LArSamples::Interface::cellHistory
const History * cellHistory(unsigned int i) const
Definition: Interface.cxx:116
LArSamples::LArCellsEmptyMonitoring::m_Ethreshold
double m_Ethreshold
Definition: LArCellsEmptyMonitoring.h:100
athena.value
value
Definition: athena.py:124
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
GetEntries
TGraphErrors * GetEntries(TH2F *histo)
Definition: TRTCalib_makeplots.cxx:4019
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
LArSamples::CellInfo::phi
double phi() const
Definition: CellInfo.h:94
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
LArSamples::LArCellsEmptyMonitoring::m_input_lbmax
int m_input_lbmax
Definition: LArCellsEmptyMonitoring.h:95
covarianceTool.filter
filter
Definition: covarianceTool.py:514
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
compareGeometries.outputFile
string outputFile
Definition: compareGeometries.py:25
hotSpotInTAG.c0
c0
Definition: hotSpotInTAG.py:192
LArSamples::LArCellsEmptyMonitoring::m_SaveRootTree
bool m_SaveRootTree
Definition: LArCellsEmptyMonitoring.h:90
Ringer::PS
@ PS
Definition: CaloRingsDefs.h:46
LArSamples::LArCellsEmptyMonitoring::m_ReadDefectLBList
bool m_ReadDefectLBList
Definition: LArCellsEmptyMonitoring.h:113
LArSamples::LArCellsEmptyMonitoring::m_SaveTextFile
bool m_SaveTextFile
Definition: LArCellsEmptyMonitoring.h:91
THArray
std::array< std::unique_ptr< T >, n > THArray
Definition: LArCellsEmptyMonitoring.cxx:57
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ev
int ev
Definition: globals.cxx:25
LArSamples::CellInfo::onlid
ULong64_t onlid() const
Definition: CellInfo.h:90
python.BunchSpacingUtils.lb
lb
Definition: BunchSpacingUtils.py:88
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
TH2Fp
std::unique_ptr< TH2F > TH2Fp
Definition: LArCellsEmptyMonitoring.cxx:60
xAOD::nCells
setRawEt setRawPhi nCells
Definition: TrigCaloCluster_v1.cxx:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
xmin
double xmin
Definition: listroot.cxx:60
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
dqt_zlumi_alleff_HIST.fout
fout
Definition: dqt_zlumi_alleff_HIST.py:59
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
master.flag
bool flag
Definition: master.py:29
LArSamples::LArCellsEmptyMonitoring::m_PartitionName
std::string m_PartitionName
Definition: LArCellsEmptyMonitoring.h:110
LArSamples::Interface::eventData
const EventData * eventData(unsigned int i) const
Definition: Interface.h:54
LArSamples::EventData::run
int run() const
Definition: EventData.cxx:59
run
Definition: run.py:1
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
LArSamples::LArCellsEmptyMonitoring::m_RMS_checkBadLBs
double m_RMS_checkBadLBs
Definition: LArCellsEmptyMonitoring.h:112
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
checkCorrelInHIST.nLB
int nLB
Definition: checkCorrelInHIST.py:21
LArSamples::LArCellsEmptyMonitoring::GetBadLBList
std::vector< int, std::allocator< int > > GetBadLBList(const char *inputfile, int lbmin, int lbmax, double nsigma, int nlb, const std::vector< int, std::allocator< int > > &DQLBList)
Definition: LArCellsEmptyMonitoring.cxx:1070
LArSamples::LArCellsEmptyMonitoring::m_RemoveBadLB
bool m_RemoveBadLB
Definition: LArCellsEmptyMonitoring.h:96
LArSamples::LArCellsEmptyMonitoring::m_Mean_checkBadLBs
double m_Mean_checkBadLBs
Definition: LArCellsEmptyMonitoring.h:111
LArSamples::LArCellsEmptyMonitoring::m_SelectRecurringBadCells
bool m_SelectRecurringBadCells
Definition: LArCellsEmptyMonitoring.h:107
LArSamples::LArCellsEmptyMonitoring::m_nexpected
int m_nexpected
Definition: LArCellsEmptyMonitoring.h:86
DiTauMassTools::HistInfo::RMS
@ RMS
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:35
defineDB.ichan
int ichan
Definition: JetTagCalibration/share/defineDB.py:28
LArSamples::Interface::open
static Interface * open(const TString &fileName)
Definition: Interface.cxx:35
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
LArSamples::Data
Definition: Data.h:72
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
LArSamples::LArCellsEmptyMonitoring::m_LowerCountThreshold
int m_LowerCountThreshold
Definition: LArCellsEmptyMonitoring.h:102
threshold
Definition: chainparser.cxx:74
LArSamples::LArCellsEmptyMonitoring::m_UpperCellEnergyThreshold
double m_UpperCellEnergyThreshold
Definition: LArCellsEmptyMonitoring.h:104
LArSamples::LArCellsEmptyMonitoring::m_MaskCalo
bool m_MaskCalo
Definition: LArCellsEmptyMonitoring.h:106
LArSamples::LArCellsEmptyMonitoring::m_PartitionIndex
int m_PartitionIndex
Definition: LArCellsEmptyMonitoring.h:109
THVec
std::vector< std::unique_ptr< T > > THVec
Definition: LArCellsEmptyMonitoring.cxx:54
LArSamples::CellInfo
Definition: CellInfo.h:31
LArSamples::LArCellsEmptyMonitoring::GetCryostat
std::string GetCryostat(int calo)
Definition: LArCellsEmptyMonitoring.cxx:1420
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
LArSamples::LArCellsEmptyMonitoring::ReadBadLBList
std::vector< int, std::allocator< int > > ReadBadLBList(const TString &LBfile)
Definition: LArCellsEmptyMonitoring.cxx:1451
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
LArSamples::CellInfo::channel
short channel() const
Definition: CellInfo.h:76
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
DeMoScan.index
string index
Definition: DeMoScan.py:364
a
TList * a
Definition: liststreamerinfos.cxx:10
LArSamples::LArCellsEmptyMonitoring::Run
void Run(const TString &inputfile)
Definition: LArCellsEmptyMonitoring.cxx:422
python.compareTCTs.ratio
ratio
Definition: compareTCTs.py:295
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
LArSamples::LArCellsEmptyMonitoring::m_nsigma
double m_nsigma
Definition: LArCellsEmptyMonitoring.h:98
FullCPAlgorithmsTest_CA.inputfile
dictionary inputfile
Definition: FullCPAlgorithmsTest_CA.py:62
LArSamples::LArCellsEmptyMonitoring::m_SetLumiblockRange
bool m_SetLumiblockRange
Definition: LArCellsEmptyMonitoring.h:93
compute_lumi.lbmax
lbmax
Definition: compute_lumi.py:37
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
xmax
double xmax
Definition: listroot.cxx:61
LArSamples::LArCellsEmptyMonitoring::CheckForPresamplerCells
bool CheckForPresamplerCells(int index)
Definition: LArCellsEmptyMonitoring.cxx:1379
LArSamples::LArCellsEmptyMonitoring::m_MaskPresampler
bool m_MaskPresampler
Definition: LArCellsEmptyMonitoring.h:105
LArSamples::LArCellsEmptyMonitoring::m_LowerCellEnergyThreshold
double m_LowerCellEnergyThreshold
Definition: LArCellsEmptyMonitoring.h:103
LArSamples::LArCellsEmptyMonitoring::m_Algo
int m_Algo
Definition: LArCellsEmptyMonitoring.h:92
LArSamples::LArCellsEmptyMonitoring::GetLimits_EqLB
void GetLimits_EqLB(const char *inputfile, int &lbmin, int &lbmax, int &emin, int &emax, int &qmin, int &qmax, int &runNumber, const std::vector< int, std::allocator< int > > &BadLBList)
Definition: LArCellsEmptyMonitoring.cxx:1017
LArSamples::Interface
Definition: Interface.h:36
str
Definition: BTagTrackIpAccessor.cxx:11
LArSamples::EventData::lumiBlock
unsigned int lumiBlock() const
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/EventData.h:47
LArSamples::Interface::historySize
unsigned int historySize(unsigned int i) const
Definition: Interface.h:57
LArSamples::LArCellsEmptyMonitoring::m_LBfile
TString m_LBfile
Definition: LArCellsEmptyMonitoring.h:114
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
LArSamples::CellInfo::eta
double eta() const
Definition: CellInfo.h:93
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
TH1Fp
std::unique_ptr< TH1F > TH1Fp
Definition: LArCellsEmptyMonitoring.cxx:59
PlotCalibFromCool.partname
partname
Definition: PlotCalibFromCool.py:80
LArSamples::EventData
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/EventData.h:29
python.compressB64.c
def c
Definition: compressB64.py:93
LArSamples::CellInfo::layer
short layer() const
Definition: CellInfo.h:53
LArSamples::AbsLArCells::nChannels
virtual unsigned int nChannels() const
Definition: AbsLArCells.h:34
WriteCellNoiseToCool.noise
noise
Definition: WriteCellNoiseToCool.py:380
LArMonTransforms.Mean
def Mean(inputs)
Definition: LArMonTransforms.py:438
fitman.k
k
Definition: fitman.py:528
compute_lumi.lbmin
lbmin
Definition: compute_lumi.py:37