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 62 of file LArCellsEmptyMonitoring.cxx.

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

◆ ~LArCellsEmptyMonitoring()

LArCellsEmptyMonitoring::~LArCellsEmptyMonitoring ( )

Definition at line 90 of file LArCellsEmptyMonitoring.cxx.

91 {
92 }

◆ 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 1223 of file LArCellsEmptyMonitoring.cxx.

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

◆ 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 1337 of file LArCellsEmptyMonitoring.cxx.

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

◆ CheckEventSelectionCriteria()

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

Definition at line 1323 of file LArCellsEmptyMonitoring.cxx.

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

◆ CheckForPresamplerCells()

bool LArCellsEmptyMonitoring::CheckForPresamplerCells ( int  index)

Definition at line 1378 of file LArCellsEmptyMonitoring.cxx.

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

◆ CheckPartition()

bool LArCellsEmptyMonitoring::CheckPartition ( int  index) const

Definition at line 1384 of file LArCellsEmptyMonitoring.cxx.

1384  {
1385  return index == m_PartitionIndex;
1386 }

◆ DoEtaPhiMonitoring()

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

Definition at line 1557 of file LArCellsEmptyMonitoring.cxx.

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

◆ 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 1069 of file LArCellsEmptyMonitoring.cxx.

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

◆ GetCryostat()

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

Definition at line 1419 of file LArCellsEmptyMonitoring.cxx.

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

◆ 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 1016 of file LArCellsEmptyMonitoring.cxx.

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

◆ 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 1233 of file LArCellsEmptyMonitoring.cxx.

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

◆ operator=()

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

◆ ReadBadLBList()

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

Definition at line 1450 of file LArCellsEmptyMonitoring.cxx.

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

◆ ReadDefectLBList()

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

Definition at line 1435 of file LArCellsEmptyMonitoring.cxx.

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

◆ 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 421 of file LArCellsEmptyMonitoring.cxx.

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

◆ ScanOnlids()

void LArCellsEmptyMonitoring::ScanOnlids ( const TString &  inputfile)

Definition at line 1504 of file LArCellsEmptyMonitoring.cxx.

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

◆ 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 1389 of file LArCellsEmptyMonitoring.cxx.

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

◆ 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 94 of file LArCellsEmptyMonitoring.cxx.

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

◆ TriggerEfficiency()

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

Definition at line 1709 of file LArCellsEmptyMonitoring.cxx.

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

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:1323
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:1223
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:1233
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:1384
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:1337
index
Definition: index.py:1
plotmaker.hist
hist
Definition: plotmaker.py:148
LArSamples::History
Definition: History.h:40
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:114
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
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
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:56
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:59
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:1069
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:33
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
LArSamples::Data
Definition: Data.h:77
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:53
LArSamples::CellInfo
Definition: CellInfo.h:31
LArSamples::LArCellsEmptyMonitoring::GetCryostat
std::string GetCryostat(int calo)
Definition: LArCellsEmptyMonitoring.cxx:1419
LArSamples::LArCellsEmptyMonitoring::ReadBadLBList
std::vector< int, std::allocator< int > > ReadBadLBList(const TString &LBfile)
Definition: LArCellsEmptyMonitoring.cxx:1450
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:421
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:59
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:1378
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:1016
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:58
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