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

54  : m_LarIdTranslator (std::make_unique<LArIdTranslatorHelper>("LarIdTree.root"))
55 {
56  // class constructor - set your class variables to default values here
57 
58  m_nexpected = 195072; // entries expected from Calo container
59 
60 
61  m_SaveRootFile = false;
62  m_SaveTextFile = true;
63  m_Algo = 2;
64  m_SetLumiblockRange = false;
65  m_input_lbmin = 0;
66  m_input_lbmax = 0;
67  m_RemoveBadLB = true;
68  m_Qthreshold = 4000;
69  m_nsigma = 4.;
70  m_Ethreshold = 1.;
76  m_nsigmaHits = 10.;
77  m_SaveRootTree = false;
78  m_SetPartition = false;
79 }

◆ ~LArCellsEmptyMonitoring()

LArCellsEmptyMonitoring::~LArCellsEmptyMonitoring ( )

Definition at line 81 of file LArCellsEmptyMonitoring.cxx.

82 {
83 }

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

1185  {
1186  for (unsigned int yy=0;yy<BadLBList.size();yy++){
1187  if (lumiBlock == BadLBList[yy]){
1188  return true;
1189  }
1190  }
1191  return false;
1192 }

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

1301  {
1302  //FLAG KEY:
1303  //selectionFlag == 0 -> Used EventEnergyCut
1304  //selectionFlag == 1 -> Used MeanCellHitCut
1305  //selectionFlag == 2 -> Used EventEnergyCut && MeanCellHitCut
1306 
1307 
1308  bool a=false;
1309  bool b=false;
1310  bool c=false;
1311 
1312  //pas bon if ((EventCount > (MeanHits[GetSectionIndex(index)]+(nsigmaHits*rmsHits[GetSectionIndex(index)]))*(nlb-nBadLBs[GetCryoIndex(index)]))) a=true;
1313 
1314  //original
1315  if ((EventCount > (MeanHits+(nsigmaHits*rmsHits))*((double)nlb-(double)nBadLBs))) a=true;
1316  // reverse cut
1317  // if ((EventCount < (MeanHits+(nsigmaHits*rmsHits))*((double)nlb-(double)nBadLBs))) a=true;
1318 
1319  //original
1320  if (nEvents_E_gt_ecut > m_UpperCountThreshold && (EventEnergySum/(double)nEvents_E_gt_ecut) > m_LowerCellEnergyThreshold) b=true;
1321  // reverse cut
1322  // if (nEvents_E_gt_ecut < m_UpperCountThreshold && (EventEnergySum/(double)nEvents_E_gt_ecut) < m_LowerCellEnergyThreshold) b=true;
1323 
1324  //original
1325  if (nEvents_E_gt_ecut > m_LowerCountThreshold && (EventEnergySum/(double)nEvents_E_gt_ecut) > m_UpperCellEnergyThreshold) c=true;
1326  // reverse cut
1327  // if (nEvents_E_gt_ecut < m_LowerCountThreshold && (EventEnergySum/(double)nEvents_E_gt_ecut) < m_UpperCellEnergyThreshold) c=true;
1328 
1329 
1330  if ((a && b) || (a && c)){
1331  return 2;
1332  } else if (a && !b && !c){
1333  return 1;
1334  } else if ((!a && b) || (!a && c)){
1335  return 0;
1336  }
1337 
1338  return -1;
1339 }

◆ CheckEventSelectionCriteria()

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

Definition at line 1287 of file LArCellsEmptyMonitoring.cxx.

1287  {
1288 
1289 
1290  if (energy == 0 || noise == 0){
1291  return false;
1292  } else if (lumiBlock <= lbmax && lumiBlock >= lbmin && energy > sqrt((nsigma*noise)*(nsigma*noise)) ) { // use only LBs in range
1293  return true;
1294  }
1295  return false;
1296 
1297 }

◆ CheckForPresamplerCells()

bool LArCellsEmptyMonitoring::CheckForPresamplerCells ( int  index)

Definition at line 1342 of file LArCellsEmptyMonitoring.cxx.

1342  {
1343 
1344  return index == 0 || index == 4;
1345 }

◆ CheckPartition()

bool LArCellsEmptyMonitoring::CheckPartition ( int  index) const

Definition at line 1348 of file LArCellsEmptyMonitoring.cxx.

1348  {
1349  return index == m_PartitionIndex;
1350 }

◆ DoEtaPhiMonitoring()

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

Definition at line 1524 of file LArCellsEmptyMonitoring.cxx.

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

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

1030  {
1031  std::map< std::pair<unsigned int, unsigned int>, unsigned int > eventCells_tot;
1032  std::map< std::pair<unsigned int, unsigned int>, double > eventEnergy_tot;
1033  std::map< std::pair<unsigned int, unsigned int>, unsigned int > eventLumiBlock;
1034  std::map< std::pair<std::string, unsigned int>, unsigned int > eventCells;
1035  int lb=0.;
1036  double NSIG = nsigma;
1037 
1038  // Opening file:
1040  unsigned int nchannels = tuple->nChannels();
1041 
1042  // -------------------------------------------------------------------------
1043  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1044  // pass empty cells
1045  if(tuple->historySize(ichan)==0){ continue; }
1046 
1047  // process non empty cells
1048  const LArSamples::History* hist = tuple->cellHistory(ichan);
1049  const LArSamples::CellInfo* cellInfo = hist->cellInfo();
1050  int index = m_LarIdTranslator->GetPartitionLayerIndex(cellInfo->calo(),cellInfo->layer());
1051  int calo = cellInfo->calo();
1052 
1053  if (m_MaskPresampler){
1054  if (CheckForPresamplerCells(index)){ continue; }
1055  }
1056  if (m_MaskCalo){
1057  if (!CheckForPresamplerCells(index)){ continue; }
1058  }
1059 
1060  unsigned int ndigits = hist->nData();
1061  if(ndigits==0){ continue; }
1062 
1063  // loop on the events for each cell
1064  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
1065  const LArSamples::Data* data = hist->data(idigit);
1066 
1067  const LArSamples::EventData* Evdata = data->eventData();
1068  if(!Evdata) continue;
1069  int lumiBlock = Evdata->lumiBlock();
1070  //int lumiBlock = data->lumiBlock();
1071 
1072  lb = (int)lumiBlock;
1073  double energyGeV = data->energy()/1000.;
1074 
1075 
1076  if (lumiBlock <= lbmax && lumiBlock >= lbmin ) { // use only LBs in range
1077  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
1078  // cell-event mapping
1079  std::pair<unsigned int, unsigned int> ev(data->run(), data->event());
1080  std::pair<std::string, unsigned int> ev_cryo(GetCryostat(calo), data->event());
1081  eventCells_tot[ev]++;
1082  eventEnergy_tot[ev] += energyGeV;
1083  eventLumiBlock[ev] = lb;
1084  eventCells[ev_cryo]++;
1085  }
1086  }
1087  }
1088  }
1089  // -------------------------------------------------------------------------
1090  // Find Bad LBs -> make list (BadLB vector output)
1091  // -------------------------------------------------------------------------
1092  TProfile* hCells_Ev_LB = new TProfile("","",nlb,lbmin,lbmax,-100,100000);//averaged number of cells per event per LB
1093  std::map< std::string, TProfile*> hCellsEvLB;
1094  std::map< std::string, TH1F*> hp_cryo;
1095  // -------------------------------------------------------------------------
1096  // loop over events (based on Interface::ShowEvents).
1097  // -------------------------------------------------------------------------
1098  int nCryo = 8;
1099  std::string Cryo[8] = {"EMBA","EMBC","EMECA","EMECC","HECA", "HECC","FCALA","FCALC"};
1100  for(int k = 0; k< nCryo; k++){
1101  hCellsEvLB[Cryo[k]] = (TProfile*)hCells_Ev_LB->Clone();
1102  }
1103  for(unsigned int ievent = 0; ievent < tuple->nEvents(); ievent++) {
1104  const LArSamples::EventData* evtData = tuple->eventData(ievent);
1105  std::pair<unsigned int, unsigned int> id(evtData->run(), evtData->event());
1106  if(eventCells_tot[id]==0) continue;
1107 
1108  for(int j=0; j<nCryo ;j++){
1109  std::pair<std::string, unsigned int> id_cryo(Cryo[j], evtData->event());
1110  hCellsEvLB[Cryo[j]]->Fill(eventLumiBlock[id], eventCells[id_cryo]);
1111  }
1112 
1113  hCells_Ev_LB->Fill(eventLumiBlock[id], eventCells_tot[id]);
1114  }
1115 
1116  TH1F* hp = new 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
1117  for(int k = 0; k< nCryo; k++){
1118  TH1F* hp_temp = new 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
1119  std::string name1 = "hp_" + Cryo[k];
1120  hp_cryo[Cryo[k]] = (TH1F*)hp_temp->Clone(name1.c_str());
1121  }
1122 
1123  for (int p=1;p<=nlb;p++){
1124  for(int j=0; j<nCryo; j++){
1125  double bincont = hCellsEvLB[Cryo[j]]->GetBinContent(p);
1126  hp_cryo[Cryo[j]]->Fill(bincont);
1127  }
1128  double bincont1 = hCells_Ev_LB->GetBinContent(p);
1129  hp->Fill(bincont1);
1130  }
1131 
1132  std::map< std::string, double> Mean;
1133  std::map< std::string, double> RMS;
1134  std::map< int, vector<std::string> > BadLB_cryo;
1135 
1136  for(int k=0; k<nCryo; k++)
1137  {
1138  Mean[Cryo[k]] = hp_cryo[Cryo[k]]->GetMean();
1139  RMS[Cryo[k]] = hp_cryo[Cryo[k]]->GetRMS();
1140  }
1141 
1142  double MEAN2 = hp->GetMean();
1143  double RMS2 = hp->GetRMS();
1144  m_Mean_checkBadLBs = MEAN2;
1145  m_RMS_checkBadLBs = RMS2;
1146  vector<int> BadLB;
1147  // vector<int> BadLB_tot;
1148  vector<int> BadLB_tot=DQLBList;
1149 
1150  double value1 = (MEAN2+(RMS2*3.));
1151  int numberFlagged=0;
1152  for (int l=1;l<=nlb;l++){
1153  for(int j=0; j<nCryo; j++){
1154  double value = MEAN2 + (RMS[Cryo[j]]*3);
1155  if(hCellsEvLB[Cryo[j]]->GetBinContent(l) > value){
1156  int badLB = hCellsEvLB[Cryo[j]]->GetBinLowEdge(l);
1157  BadLB_cryo[badLB].push_back(Cryo[j]);
1158  bool isadd = true;
1159  for(unsigned int p=0; p< BadLB_tot.size(); p++) {
1160  if(badLB == BadLB_tot[p]) isadd = false;
1161  }
1162  if(isadd){
1163  BadLB_tot.push_back(badLB);
1164  numberFlagged++;
1165  printf("Removing bad LB %d in %s\n",badLB,Cryo[j].c_str());
1166  }
1167  }
1168  }
1169 
1170  if (hCells_Ev_LB->GetBinContent(l) > value1){
1171  BadLB.push_back(hCells_Ev_LB->GetBinLowEdge(l));
1172  }
1173  }
1174  printf("\n");
1175  printf("Number of Bad LBs found: %d\n",numberFlagged);
1176  printf("Number of LBs to be removed: %zu", BadLB_tot.size());
1177  printf("\n");
1178  delete tuple;
1179 
1180  return BadLB_tot;
1181 }

◆ GetCryostat()

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

Definition at line 1383 of file LArCellsEmptyMonitoring.cxx.

1384 {
1385  std::string cryostat = "NotGiven";
1386  if(calo == 1) cryostat = "EMBA";
1387  else if(calo == -1) cryostat = "EMBC";
1388  else if(calo == 5) cryostat = "FCALA";
1389  else if(calo == -5) cryostat = "FCALC";
1390  else if(calo == 4) cryostat = "HECA";
1391  else if(calo == -4) cryostat = "HECC";
1392  else if(calo == 2 || calo == 3) cryostat = "EMECA";
1393  else if(calo == -2 || calo == -3) cryostat = "EMECC";
1394  return cryostat;
1395 }

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

977  {
978  int lb=0.;
979 
980  // Opening file:
982 
983  unsigned int nchannels = tuple->nChannels();
984 
985  // -------------------------------------------------------------------------
986  qmin = emin = lbmin = 99999;
987  qmax = emax = lbmax = -1;
988  runNumber = 0.;
989 
990  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
991  // pass empty cells
992  if(tuple->historySize(ichan)==0){ continue; }
993 
994  // process non empty cells
995  const LArSamples::History* hist = tuple->cellHistory(ichan);
996 
997  unsigned int ndigits = hist->nData();
998  if(ndigits==0){ continue; }
999 
1000  // loop on the events for each cells
1001  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
1002  const LArSamples::Data* data = hist->data(idigit);
1003  const LArSamples::EventData* Evdata = data->eventData();
1004  if(!Evdata) continue;
1005  int lumiBlock = Evdata->lumiBlock();
1006 
1007 
1008  if (data->energy() != 0. && data->noise() != 0.){ // record only events with real energy/noise values
1009  bool isBadLB = CheckBadLBList(lumiBlock,BadLBList);
1010  //skip bad LBs
1011  if (isBadLB) continue;
1012 
1013 
1014  lb = (int)lumiBlock;
1015  if(lb>lbmax) lbmax = lb;
1016  if(lb<lbmin) lbmin = lb;
1017  double energyGeV = data->energy()/1000.;
1018  if(energyGeV > emax) emax = energyGeV;
1019  if(energyGeV < emin) emin = energyGeV;
1020  if(data->quality() > qmax) qmax = data->quality();
1021  if(data->quality() < qmin) qmin = data->quality();
1022 
1023  runNumber = data->run();
1024  }
1025  }
1026  }
1027 }

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

1196 {
1197 
1198 
1199  int nHits = 0., lumiBlock = 0.,nCells = 0.;
1200  double energy = 0, noise = 0;
1202  unsigned int nchannels = tuple->nChannels();
1203 
1204  //TH1F* h1_hits = new TH1F("","",nlb,lbmin,lbmax); // temp histo filled with every event in cell with E>4sig
1205  double TotalRecordedHits=0;
1206  std::vector<int, std::allocator<int> > HitsPerLB;
1207  double var=0;
1208  TH1F* th1_Hits = new TH1F("","",nlb,lbmin,lbmax); // number of events (E>nsig) in each LB for each cell
1209  TH1F* hNLB = new TH1F("","",nlb,lbmin,lbmax); // number of lumiblocks
1210 
1211  // -------------------------------------------------------------------------
1212  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1213  // pass empty cells
1214  if(tuple->historySize(ichan)==0){ continue; }
1215 
1216 
1217  // process non empty cells
1218  const LArSamples::History* hist = tuple->cellHistory(ichan);
1219 
1220  unsigned int ndigits = hist->nData();
1221 
1222  // loop on the events for each cells
1223  for(unsigned int idigit = 0; idigit < ndigits; idigit++){
1224  const LArSamples::Data* data = hist->data(idigit);
1225  const LArSamples::EventData* Evdata = data->eventData();
1226  if(!Evdata) continue;
1227  lumiBlock = Evdata->lumiBlock();
1228 
1229  energy = data->energy();
1230  noise = data->noise();
1231  bool isBadLB = CheckBadLBList(lumiBlock,BadLBList);
1232  if (isBadLB) continue; //skip bad LBs
1233  hNLB->Fill(lumiBlock);
1234 
1235  bool ProcessEvent = CheckEventSelectionCriteria(lumiBlock, nsigma, energy, noise, lbmin, lbmax);
1236  if (ProcessEvent){
1237 
1238 
1239  th1_Hits->Fill(lumiBlock);
1240  nHits++;
1241  }
1242  }
1243  if (nHits > 0.) nCells++;
1244 
1245  nHits = 0.;
1246 
1247  }
1248 
1249 
1250  // -------------------------------------------------------------------------
1251  // determine average #hits per cell per LB
1252  // -------------------------------------------------------------------------
1253 
1254 
1255 
1256  TH1F* tp_ev = new TH1F("","",th1_Hits->GetBinContent(th1_Hits->GetMaximumBin())*100,0,th1_Hits->GetBinContent(th1_Hits->GetMaximumBin()));
1257 
1258  for (int i=1;i<=nlb;i++){
1259  if(hNLB->GetBinContent(i)>0){
1260  nlb_corr++;
1261  tp_ev->Fill(th1_Hits->GetBinContent(i));
1262  TotalRecordedHits+=th1_Hits->GetBinContent(i);
1263  HitsPerLB.push_back(th1_Hits->GetBinContent(i));
1264  }
1265  }
1266 
1267  MeanHits = ((double)TotalRecordedHits/(double)nlb_corr)/(double)nCells;
1268  // MeanHits = tp_ev->GetMean()/(double)nCells;
1269  // rmsHits = tp_ev->GetRMS()/(double)nCells;
1270 
1271  for (unsigned int j=0;j<HitsPerLB.size();j++){
1272  var += (((double)HitsPerLB[j]/(double)nCells) - MeanHits)*(((double)HitsPerLB[j]/(double)nCells) - MeanHits);
1273  }
1274 
1275  rmsHits = var/nlb_corr;
1276 
1277  printf("Mean number of hits/cell for 1 LB = %4.3f, RMS = %4.3f\n",MeanHits,rmsHits);
1278  printf("Number of cells firing at E > %d sigma = %d\n",nsigma,nCells);
1279  printf("Total number of LBs included = %d\n",nlb_corr);
1280 
1281 
1282  if (th1_Hits) delete th1_Hits;
1283 
1284 }

◆ operator=()

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

◆ ReadBadLBList()

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

Definition at line 1414 of file LArCellsEmptyMonitoring.cxx.

1415 {
1416  std::vector<int> LBList;
1417 
1418  std::ifstream infile(LBfile.Data());
1419  std::string line;
1420 
1421  // assume single-line format with coma-separated LBs (from python)
1422  std::getline(infile,line,'\n');
1423  TString filter(line.c_str());
1424  TObjArray* list = filter.Tokenize(", "); // coma\space delimiters
1425  if(list->GetEntries() == 0){
1426  printf("No LB filtering specified, or bad format. Exiting.\n");
1427  delete list;
1428  LBList.push_back(0);
1429  return LBList;
1430  }
1431 
1432  for(int k = 0; k < list->GetEntries(); k++){
1433  TObjString* tobs = (TObjString*)(list->At(k));
1434  LBList.push_back((int)(tobs->String()).Atoi());
1435  }
1436  delete list;
1437  printf("LB List: %d\n",(int)LBList.size());
1438 
1439  return LBList;
1440 }

◆ ReadDefectLBList()

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

Definition at line 1399 of file LArCellsEmptyMonitoring.cxx.

1400 {
1401 
1402 
1403  if (!ReadList){
1404  m_LBfile="";
1405  m_ReadDefectLBList=false;
1406  }
1407  else{
1408  m_LBfile=LBfile;
1409  m_ReadDefectLBList=true;
1410  }
1411 }

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

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

◆ ScanOnlids()

void LArCellsEmptyMonitoring::ScanOnlids ( const TString &  inputfile)

Definition at line 1471 of file LArCellsEmptyMonitoring.cxx.

1472 {
1473  // Scans all channel entries in the ntuple and looks for duplicates onlids.
1474 
1475  int index = -1;
1476  ULong64_t onlid = 0;
1477  std::map<ULong64_t,unsigned int>* idmap = new std::map<ULong64_t,unsigned int>;
1479  int nskipped=0,nrepeated=0;
1480 
1481  // Opening file:
1483  printf("Number of events: %u %u\n",tuple->nEvents(),tuple->nChannels()); //tuple->ShowEvents("energy>0.");
1484  unsigned int nchannels = tuple->nChannels();
1485 
1486  // -------------------------------------------------------------------------
1487  for(unsigned int ichan = 0; ichan < nchannels; ichan++){
1488  // pass empty cells
1489  if(tuple->historySize(ichan)==0){ nskipped++; continue; }
1490 
1491  // process non empty cells
1492  const LArSamples::History* hist = tuple->cellHistory(ichan);
1493  const LArSamples::CellInfo* cellInfo = hist->cellInfo();
1494 
1495  // index for partition
1496  index = m_LarIdTranslator->GetPartitionLayerIndex(cellInfo->calo(),cellInfo->layer());
1497  onlid = cellInfo->onlid();
1498  /*
1499  if(m_LarIdTranslator->FindChannel(index,cellInfo->eta(),cellInfo->phi())){
1500  onlid = m_LarIdTranslator->onlid;
1501  } else onlid = 0;
1502  */
1503  if(onlid<=0) printf("%u: Bad Cell Onlid = 0x%x (%+.2f,%+.2f)\n",ichan,(unsigned int)onlid,cellInfo->eta(),cellInfo->phi());
1504 
1505  idmap_itr = idmap->find(onlid);
1506 
1507  // new onlid
1508  if(idmap_itr == idmap->end()){
1509  (*idmap)[onlid] = ichan;
1510  } else {
1511  nrepeated+=1;
1512  printf("Onlid 0x%x (%d,%s,%+.2f,%+.2f)\n",(unsigned int)onlid,index,m_LarIdTranslator->GetPartitonLayerName(index),
1514  }
1515  }
1516 
1517  printf("Skipped %d cells.\n",nskipped);
1518  printf("Number of onlids: Unique=%d, Repeated=%d\n",(int)idmap->size(),nrepeated);
1519 
1520  return;
1521 }

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

1354 {
1355  const int npl = m_LarIdTranslator->GetNpl();
1356 
1357  m_SetPartition = setpart;
1358 
1359  if(!setpart)
1360  {
1361  m_PartitionName = "";
1362  m_PartitionIndex = -1;
1363  }
1364  else if(setpart)
1365  {
1366  bool isFoundPartition = false;
1367  for(int i=0; i< npl; i++){
1368  if(partname == m_LarIdTranslator->GetPartitonLayerName(i)){
1369  m_PartitionName = "_" +partname;
1370  m_PartitionIndex = i;
1371  isFoundPartition = true;
1372  }
1373  }
1374  if(!isFoundPartition){
1375  printf("ERROR: Partition %s does not exist! Invalid input name.\n",partname.c_str());
1376  printf("Possible candidates are:\n");
1377  for (int j=0;j<npl;j++){ printf("%s\n",m_LarIdTranslator->GetPartitonLayerName(j)); }
1378  std::abort();
1379  }
1380  }
1381 }

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

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

◆ TriggerEfficiency()

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

Definition at line 1674 of file LArCellsEmptyMonitoring.cxx.

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

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:1287
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:1185
extractSporadic.nhists
nhists
Definition: extractSporadic.py:111
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
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:1195
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
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:1348
LArSamples::CellInfo::calo
CaloId calo() const
Definition: CellInfo.h:50
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
run.infile
string infile
Definition: run.py:13
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
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:272
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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:1301
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:122
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
LArSamples::CellInfo::phi
double phi() const
Definition: CellInfo.h:94
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
LArSamples::LArCellsEmptyMonitoring::m_input_lbmax
int m_input_lbmax
Definition: LArCellsEmptyMonitoring.h:95
covarianceTool.filter
filter
Definition: covarianceTool.py:514
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
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
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
xAOD::nCells
setRawEt setRawPhi nCells
Definition: TrigCaloCluster_v1.cxx:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
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:1030
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
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:191
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
LArSamples::CellInfo
Definition: CellInfo.h:31
LArSamples::LArCellsEmptyMonitoring::GetCryostat
std::string GetCryostat(int calo)
Definition: LArCellsEmptyMonitoring.cxx:1383
LArSamples::LArCellsEmptyMonitoring::ReadBadLBList
std::vector< int, std::allocator< int > > ReadBadLBList(const TString &LBfile)
Definition: LArCellsEmptyMonitoring.cxx:1414
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:362
a
TList * a
Definition: liststreamerinfos.cxx:10
LArSamples::LArCellsEmptyMonitoring::Run
void Run(const TString &inputfile)
Definition: LArCellsEmptyMonitoring.cxx:413
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
generate::GetEntries
double GetEntries(TH1D *h, int ilow, int ihi)
Definition: rmsFrac.cxx:20
DiTauMassTools::HistInfoV2::RMS
@ RMS
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:31
xmax
double xmax
Definition: listroot.cxx:61
LArSamples::LArCellsEmptyMonitoring::CheckForPresamplerCells
bool CheckForPresamplerCells(int index)
Definition: LArCellsEmptyMonitoring.cxx:1342
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:977
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
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
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