Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:40

0001 #include "CaloFittingQA.h"
0002 
0003 // Calo includes
0004 #include <calobase/TowerInfo.h>
0005 #include <calobase/TowerInfoContainer.h>
0006 #include <caloreco/CaloTowerDefs.h>
0007 
0008 #include <cdbobjects/CDBTTree.h>  // for CDBTTree
0009 
0010 #include <ffarawobjects/CaloPacket.h>
0011 #include <ffarawobjects/CaloPacketContainer.h>
0012 
0013 #include <ffamodules/CDBInterface.h>
0014 
0015 #include <ffaobjects/EventHeader.h>
0016 
0017 #include <qautils/QAHistManagerDef.h>
0018 
0019 #include <fun4all/Fun4AllHistoManager.h>
0020 #include <fun4all/Fun4AllReturnCodes.h>
0021 
0022 #include <phool/getClass.h>
0023 #include <phool/phool.h>  // for PHWHERE
0024 
0025 #include <Event/Event.h>
0026 #include <Event/EventTypes.h>
0027 #include <Event/packet.h>
0028 
0029 #include <TH1.h>
0030 #include <TH2.h>
0031 #include <TProfile2D.h>
0032 
0033 #include <cassert>
0034 #include <cstdlib>
0035 #include <format>
0036 #include <iostream>  // for operator<<, endl, basic_...
0037 #include <limits>
0038 #include <map>  // for operator!=, _Rb_tree_con...
0039 #include <string>
0040 #include <utility>  // for pair
0041 #include <variant>
0042 
0043 static const std::map<CaloTowerDefs::DetectorSystem, std::string> nodemap{
0044     {CaloTowerDefs::CEMC, "CEMCPackets"},
0045     {CaloTowerDefs::HCALIN, "HCALPackets"},
0046     {CaloTowerDefs::HCALOUT, "HCALPackets"},
0047     {CaloTowerDefs::ZDC, "ZDCPackets"},
0048     {CaloTowerDefs::SEPD, "SEPDPackets"}};
0049 
0050 CaloFittingQA::CaloFittingQA(const std::string& name)
0051   : SubsysReco(name)
0052 {
0053 }
0054 
0055 CaloFittingQA::~CaloFittingQA()
0056 {
0057   delete cdbttree;
0058 }
0059 
0060 int CaloFittingQA::Init(PHCompositeNode* /*unused*/)
0061 {
0062   if (Verbosity() > 0)
0063   {
0064     std::cout << "In CaloFittingQA::Init" << std::endl;
0065   }
0066 
0067   createHistos();
0068 
0069   if (Verbosity() > 0)
0070   {
0071     std::cout << "Leaving CaloFittingQA::Init" << std::endl;
0072   }
0073   return Fun4AllReturnCodes::EVENT_OK;
0074 }
0075 
0076 int CaloFittingQA::InitRun(PHCompositeNode* /*unused*/)
0077 {
0078   if (Verbosity() > 0)
0079   {
0080     std::cout << "In CaloFittingQA::InitRun" << std::endl;
0081   }
0082 
0083   //===============
0084   // conditions DB flags
0085   //===============
0086   m_calibName = "cemc_adcskipmask";
0087   m_fieldname = "adcskipmask";
0088   std::string calibdir = CDBInterface::instance()->getUrl(m_calibName);
0089   if (calibdir.empty())
0090   {
0091     std::cout << PHWHERE << "ADC Skip mask not found in CDB, not even in the default... " << std::endl;
0092     exit(1);
0093   }
0094   cdbttree = new CDBTTree(calibdir);
0095 
0096   if (Verbosity() > 0)
0097   {
0098     std::cout << "Leaving CaloFittingQA::InitRun" << std::endl;
0099   }
0100   return Fun4AllReturnCodes::EVENT_OK;
0101 }
0102 
0103 int CaloFittingQA::process_event(PHCompositeNode* topNode)
0104 {
0105   _eventcounter++;
0106   //  std::cout << "In process_event" << std::endl;
0107   process_towers(topNode);
0108 
0109   return Fun4AllReturnCodes::EVENT_OK;
0110 }
0111 
0112 int CaloFittingQA::process_towers(PHCompositeNode* topNode)
0113 {
0114   //---------------------------Event header--------------------------------//
0115   EventHeader* eventheader =
0116       findNode::getClass<EventHeader>(topNode, "EventHeader");
0117   int event_number = 0;
0118   if (eventheader)
0119   {
0120     if (eventheader->isValid())
0121     {
0122       event_number = eventheader->get_EvtSequence();
0123     }
0124   }
0125   else
0126   {
0127     std::cout << "CaloFittingQA::process_towers()  No event header" << std::endl;
0128   }
0129 
0130   if (Verbosity() > 0)
0131   {
0132     std::cout << _eventcounter << std::endl;
0133     std::cout << "Event header evtsequence " << event_number << std::endl;
0134   }
0135   //  std::cout << "In process_towers" << std::endl;
0136   auto* hm = QAHistManagerDef::getHistoManager();
0137   assert(hm);
0138 
0139   //-------------------------- raw waveforms ------------------------------//
0140   std::vector<std::vector<float>> cemc_waveforms;
0141   std::vector<std::vector<float>> ihcal_waveforms;
0142   std::vector<std::vector<float>> ohcal_waveforms;
0143   TowerInfoContainer* cemc_sim_waveforms = nullptr;
0144   TowerInfoContainer* ihcal_sim_waveforms = nullptr;
0145   TowerInfoContainer* ohcal_sim_waveforms = nullptr;
0146   if (m_SimFlag)
0147   {
0148     cemc_sim_waveforms = findNode::getClass<TowerInfoContainer>(topNode, "WAVEFORM_CEMC");
0149     if (!cemc_sim_waveforms)
0150     {
0151       std::cout << PHWHERE << "WAVEFORM_CEMC node missing. Skipping event." << std::endl;
0152       return Fun4AllReturnCodes::ABORTEVENT;
0153     }
0154     ihcal_sim_waveforms = findNode::getClass<TowerInfoContainer>(topNode, "WAVEFORM_HCALIN");
0155     if (!ihcal_sim_waveforms)
0156     {
0157       std::cout << PHWHERE << "WAVEFORM_HCALIN node missing. Skipping event." << std::endl;
0158       return Fun4AllReturnCodes::ABORTEVENT;
0159     }
0160     ohcal_sim_waveforms = findNode::getClass<TowerInfoContainer>(topNode, "WAVEFORM_HCALOUT");
0161     if (!ohcal_sim_waveforms)
0162     {
0163       std::cout << PHWHERE << "WAVEFORM_HCALOUT node missing. Skipping event." << std::endl;
0164       return Fun4AllReturnCodes::ABORTEVENT;
0165     }
0166   }
0167   else
0168   {
0169     if (process_data(topNode, CaloTowerDefs::CEMC, cemc_waveforms) == Fun4AllReturnCodes::ABORTEVENT)
0170     {
0171       std::cout << PHWHERE << "CEMCPackets node failed unpacking. Skipping event." << std::endl;
0172       return Fun4AllReturnCodes::ABORTEVENT;
0173     }
0174     if (process_data(topNode, CaloTowerDefs::HCALIN, ihcal_waveforms) == Fun4AllReturnCodes::ABORTEVENT)
0175     {
0176       std::cout << PHWHERE << "HCALPackets node failed unpacking. Skipping event." << std::endl;
0177       return Fun4AllReturnCodes::ABORTEVENT;
0178     }
0179     if (process_data(topNode, CaloTowerDefs::HCALOUT, ohcal_waveforms) == Fun4AllReturnCodes::ABORTEVENT)
0180     {
0181       std::cout << PHWHERE << "HCALPackets node failed unpacking. Skipping event." << std::endl;
0182       return Fun4AllReturnCodes::ABORTEVENT;
0183     }
0184   }
0185 
0186   //-------------------------- ZS and multiplicity variables ------------------------------//
0187   float event_multiplicity = 0;
0188   float cemc_zs_frac = 0;
0189   float ihcal_zs_frac = 0;
0190   float ohcal_zs_frac = 0;
0191 
0192   //-------------------------- raw towers ------------------------------//
0193   {
0194     TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode, "TOWERS_CEMC");
0195     if (towers)
0196     {
0197       int size = towers->size();  // online towers should be the same!
0198       for (int channel = 0; channel < size; channel++)
0199       {
0200         TowerInfo* tower = towers->get_tower_at_channel(channel);
0201         unsigned int towerkey = towers->encode_key(channel);
0202         int ieta = towers->getTowerEtaBin(towerkey);
0203         int iphi = towers->getTowerPhiBin(towerkey);
0204         float raw_energy = tower->get_energy();
0205         if (raw_energy > m_cemc_hit_threshold)
0206         {
0207           event_multiplicity += 1;
0208         }
0209         float zs_energy = -9999;
0210         if (m_SimFlag)
0211         {
0212           if (cemc_sim_waveforms->size() > 0)
0213           {
0214             zs_energy = cemc_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(6) - cemc_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(0);
0215             h_cemc_etaphi_pedestal->Fill(ieta, iphi, cemc_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(0));
0216           }
0217         }
0218         else
0219         {
0220           if (!cemc_waveforms.empty())
0221           {
0222             if (Verbosity() > 5)
0223             {
0224               for (float i : cemc_waveforms.at(channel))
0225               {
0226                 std::cout << i << " ";
0227               }
0228               std::cout << std::endl;
0229             }
0230             if (cemc_waveforms.at(channel).size() == 2)
0231             {
0232               zs_energy = cemc_waveforms.at(channel).at(1) - cemc_waveforms.at(channel).at(0);
0233               cemc_zs_frac += 1;
0234             }
0235             else
0236             {
0237               zs_energy = cemc_waveforms.at(channel).at(6) - cemc_waveforms.at(channel).at(0);
0238             }
0239             h_cemc_etaphi_pedestal->Fill(ieta, iphi, cemc_waveforms.at(channel).at(0));
0240           }
0241         }
0242         if (Verbosity() > 0)
0243         {
0244           std::cout << "EMCal channel " << channel << " ieta " << ieta << " iphi " << iphi << " template E " << raw_energy << " ZS E " << zs_energy << std::endl;
0245         }
0246         if (raw_energy > m_cemc_adc_threshold && raw_energy < m_cemc_high_adc_threshold)
0247         {
0248           h_cemc_etaphi_ZScrosscalib->Fill(ieta, iphi, zs_energy / raw_energy);
0249         }
0250       }
0251     }
0252   }
0253   {
0254     TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode, "TOWERS_HCALOUT");
0255     if (towers)
0256     {
0257       int size = towers->size();  // online towers should be the same!
0258       for (int channel = 0; channel < size; channel++)
0259       {
0260         TowerInfo* tower = towers->get_tower_at_channel(channel);
0261         unsigned int towerkey = towers->encode_key(channel);
0262         int ieta = towers->getTowerEtaBin(towerkey);
0263         int iphi = towers->getTowerPhiBin(towerkey);
0264         float raw_energy = tower->get_energy();
0265         if (raw_energy > m_ohcal_hit_threshold)
0266         {
0267           event_multiplicity += 1;
0268         }
0269         float zs_energy = -9999;
0270         if (m_SimFlag)
0271         {
0272           if (ohcal_sim_waveforms->size() > 0)
0273           {
0274             zs_energy = ohcal_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(6) - ohcal_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(0);
0275             h_ohcal_etaphi_pedestal->Fill(ieta, iphi, ohcal_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(0));
0276           }
0277         }
0278         else
0279         {
0280           if (!ohcal_waveforms.empty())
0281           {
0282             if (ohcal_waveforms.at(channel).size() == 2)
0283             {
0284               zs_energy = ohcal_waveforms.at(channel).at(1) - ohcal_waveforms.at(channel).at(0);
0285               ohcal_zs_frac += 1;
0286             }
0287             else
0288             {
0289               zs_energy = ohcal_waveforms.at(channel).at(6) - ohcal_waveforms.at(channel).at(0);
0290             }
0291             h_ohcal_etaphi_pedestal->Fill(ieta, iphi, ohcal_waveforms.at(channel).at(0));
0292           }
0293         }
0294         if (Verbosity() > 0)
0295         {
0296           std::cout << "OHCal channel " << channel << " ieta " << ieta << " iphi " << iphi << " template E " << raw_energy << " ZS E " << zs_energy << std::endl;
0297         }
0298         if (raw_energy > m_hcal_adc_threshold && raw_energy < m_hcal_high_adc_threshold)
0299         {
0300           h_ohcal_etaphi_ZScrosscalib->Fill(ieta, iphi, zs_energy / raw_energy);
0301         }
0302       }
0303     }
0304   }
0305   {
0306     TowerInfoContainer* towers = findNode::getClass<TowerInfoContainer>(topNode, "TOWERS_HCALIN");
0307     if (towers)
0308     {
0309       int size = towers->size();  // online towers should be the same!
0310       for (int channel = 0; channel < size; channel++)
0311       {
0312         TowerInfo* tower = towers->get_tower_at_channel(channel);
0313         unsigned int towerkey = towers->encode_key(channel);
0314         int ieta = towers->getTowerEtaBin(towerkey);
0315         int iphi = towers->getTowerPhiBin(towerkey);
0316         float raw_energy = tower->get_energy();
0317         if (raw_energy > m_ihcal_hit_threshold)
0318         {
0319           event_multiplicity += 1;
0320         }
0321         float zs_energy = -9999;
0322         if (m_SimFlag)
0323         {
0324           if (ihcal_sim_waveforms->size() > 0)
0325           {
0326             zs_energy = ihcal_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(6) - ihcal_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(0);
0327             h_ihcal_etaphi_pedestal->Fill(ieta, iphi, ihcal_sim_waveforms->get_tower_at_channel(channel)->get_waveform_value(0));
0328           }
0329         }
0330         else
0331         {
0332           if (!ihcal_waveforms.empty())
0333           {
0334             if (ihcal_waveforms.at(channel).size() == 2)
0335             {
0336               zs_energy = ihcal_waveforms.at(channel).at(1) - ihcal_waveforms.at(channel).at(0);
0337               ihcal_zs_frac += 1;
0338             }
0339             else
0340             {
0341               zs_energy = ihcal_waveforms.at(channel).at(6) - ihcal_waveforms.at(channel).at(0);
0342             }
0343             h_ihcal_etaphi_pedestal->Fill(ieta, iphi, ihcal_waveforms.at(channel).at(0));
0344           }
0345         }
0346         if (Verbosity() > 0)
0347         {
0348           std::cout << "IHCal channel " << channel << " ieta " << ieta << " iphi " << iphi << " template E " << raw_energy << " ZS E " << zs_energy << std::endl;
0349         }
0350         if (raw_energy > m_hcal_adc_threshold && raw_energy < m_hcal_high_adc_threshold)
0351         {
0352           h_ihcal_etaphi_ZScrosscalib->Fill(ieta, iphi, zs_energy / raw_energy);
0353         }
0354       }
0355     }
0356   }
0357 
0358   h_cemc_zs_frac_vs_multiplicity->Fill(event_multiplicity, cemc_zs_frac / 24576.0);
0359   h_ihcal_zs_frac_vs_multiplicity->Fill(event_multiplicity, ihcal_zs_frac / 1536.0);
0360   h_ohcal_zs_frac_vs_multiplicity->Fill(event_multiplicity, ohcal_zs_frac / 1536.0);
0361 
0362   return Fun4AllReturnCodes::EVENT_OK;
0363 }
0364 
0365 int CaloFittingQA::process_data(PHCompositeNode* topNode, CaloTowerDefs::DetectorSystem dettype, std::vector<std::vector<float>>& waveforms)
0366 {
0367   int packet_low = std::numeric_limits<int>::min();
0368   int packet_high = std::numeric_limits<int>::min();
0369   int m_nsamples = 12;
0370   int m_nchannels = 192;
0371 
0372   if (dettype == CaloTowerDefs::CEMC)
0373   {
0374     packet_low = 6001;
0375     packet_high = 6128;
0376     m_nchannels = 192;
0377   }
0378   else if (dettype == CaloTowerDefs::HCALIN)
0379   {
0380     packet_low = 7001;
0381     packet_high = 7008;
0382     m_nchannels = 192;
0383   }
0384   else if (dettype == CaloTowerDefs::HCALOUT)
0385   {
0386     packet_low = 8001;
0387     packet_high = 8008;
0388     m_nchannels = 192;
0389   }
0390   else if (dettype == CaloTowerDefs::SEPD)
0391   {
0392     packet_low = 9001;
0393     packet_high = 9006;
0394     m_nchannels = 128;
0395   }
0396   else if (dettype == CaloTowerDefs::ZDC)
0397   {
0398     packet_low = 12001;
0399     packet_high = 12001;
0400     m_nchannels = 128;
0401   }
0402 
0403   std::variant<CaloPacketContainer*, Event*> event;
0404   if (m_UseOfflinePacketFlag)
0405   {
0406     CaloPacketContainer* hcalcont = findNode::getClass<CaloPacketContainer>(topNode, nodemap.find(dettype)->second);
0407     if (!hcalcont)
0408     {
0409       for (int pid = packet_low; pid <= packet_high; pid++)
0410       {
0411         if (findNode::getClass<CaloPacket>(topNode, pid))
0412         {
0413           m_PacketNodesFlag = true;
0414           break;
0415         }
0416       }
0417       if (!m_PacketNodesFlag)
0418       {
0419         std::cout << "CaloFittingQA: unable to find node " << nodemap.find(dettype)->second << "  skiping event" << std::endl;
0420         return Fun4AllReturnCodes::EVENT_OK;
0421       }
0422     }
0423     event = hcalcont;
0424   }
0425   else
0426   {
0427     Event* _event = findNode::getClass<Event>(topNode, "PRDF");
0428     if (_event == nullptr)
0429     {
0430       std::cout << PHWHERE << " Event not found" << std::endl;
0431       return Fun4AllReturnCodes::ABORTEVENT;
0432     }
0433     if (_event->getEvtType() != DATAEVENT)
0434     {
0435       return Fun4AllReturnCodes::ABORTEVENT;
0436     }
0437     event = _event;
0438   }
0439   // since the function call on Packet and CaloPacket is the same, maybe we can use lambda?
0440   auto process_packet = [&](auto* packet, int pid)
0441   {
0442     if (packet)
0443     {
0444       h_packet_events->Fill(pid);
0445       int nchannels = packet->iValue(0, "CHANNELS");
0446       if (nchannels == 0)
0447       {
0448         h_empty_packets->Fill(pid);
0449       }
0450       unsigned int adc_skip_mask = 0;
0451 
0452       if (dettype == CaloTowerDefs::CEMC)
0453       {
0454         adc_skip_mask = cdbttree->GetIntValue(pid, m_fieldname);
0455       }
0456       if (dettype == CaloTowerDefs::ZDC)
0457       {
0458         nchannels = m_nchannels;
0459       }
0460       if (nchannels > m_nchannels)  // packet is corrupted and reports too many channels
0461       {
0462         return Fun4AllReturnCodes::ABORTEVENT;
0463       }
0464 
0465       int n_pad_skip_mask = 0;
0466       for (int channel = 0; channel < nchannels; channel++)
0467       {
0468         if (skipChannel(channel, pid, dettype))
0469         {
0470           continue;
0471         }
0472         if (dettype == CaloTowerDefs::CEMC)
0473         {
0474           if (channel % 64 == 0)
0475           {
0476             unsigned int adcboard = (unsigned int) channel / 64;
0477             if ((adc_skip_mask >> adcboard) & 0x1U)
0478             {
0479               for (int iskip = 0; iskip < 64; iskip++)
0480               {
0481                 n_pad_skip_mask++;
0482                 std::vector<float> waveform;
0483                 waveform.reserve(m_nsamples);
0484 
0485                 for (int samp = 0; samp < m_nsamples; samp++)
0486                 {
0487                   waveform.push_back(0);
0488                 }
0489                 waveforms.push_back(waveform);
0490                 waveform.clear();
0491               }
0492             }
0493           }
0494         }
0495 
0496         std::vector<float> waveform;
0497         waveform.reserve(m_nsamples);
0498         if (packet->iValue(channel, "SUPPRESSED"))
0499         {
0500           waveform.push_back(packet->iValue(channel, "PRE"));
0501           waveform.push_back(packet->iValue(channel, "POST"));
0502         }
0503         else
0504         {
0505           for (int samp = 0; samp < m_nsamples; samp++)
0506           {
0507             waveform.push_back(packet->iValue(samp, channel));
0508           }
0509         }
0510         waveforms.push_back(waveform);
0511         waveform.clear();
0512       }
0513 
0514       int nch_padded = nchannels;
0515       if (dettype == CaloTowerDefs::CEMC)
0516       {
0517         nch_padded += n_pad_skip_mask;
0518       }
0519       if (nch_padded < m_nchannels)
0520       {
0521         for (int channel = 0; channel < m_nchannels - nch_padded; channel++)
0522         {
0523           if (skipChannel(channel, pid, dettype))
0524           {
0525             continue;
0526           }
0527           std::vector<float> waveform;
0528           waveform.reserve(m_nsamples);
0529 
0530           for (int samp = 0; samp < m_nsamples; samp++)
0531           {
0532             waveform.push_back(0);
0533           }
0534           waveforms.push_back(waveform);
0535           waveform.clear();
0536         }
0537       }
0538     }
0539     else  // if the packet is missing treat constitutent channels as zero suppressed
0540     {
0541       h_missing_packets->Fill(pid);
0542       for (int channel = 0; channel < m_nchannels; channel++)
0543       {
0544         if (skipChannel(channel, pid, dettype))
0545         {
0546           continue;
0547         }
0548         std::vector<float> waveform;
0549         waveform.reserve(m_nsamples);
0550         for (int samp = 0; samp < m_nsamples; samp++)
0551         {
0552           waveform.push_back(0);
0553         }
0554         waveforms.push_back(waveform);
0555         waveform.clear();
0556       }
0557     }
0558     return Fun4AllReturnCodes::EVENT_OK;
0559   };
0560 
0561   for (int pid = packet_low; pid <= packet_high; pid++)
0562   {
0563     if (!m_PacketNodesFlag)
0564     {
0565       if (auto* hcalcont = std::get_if<CaloPacketContainer*>(&event))
0566       {
0567         CaloPacket* packet = (*hcalcont)->getPacketbyId(pid);
0568         if (process_packet(packet, pid) == Fun4AllReturnCodes::ABORTEVENT)
0569         {
0570           return Fun4AllReturnCodes::ABORTEVENT;
0571         }
0572       }
0573       else if (auto* _event = std::get_if<Event*>(&event))
0574       {
0575         Packet* packet = (*_event)->getPacket(pid);
0576         if (process_packet(packet, pid) == Fun4AllReturnCodes::ABORTEVENT)
0577         {
0578           // I think it is safe to delete a nullptr...
0579           delete packet;
0580           return Fun4AllReturnCodes::ABORTEVENT;
0581         }
0582 
0583         delete packet;
0584       }
0585     }
0586     else
0587     {
0588       CaloPacket* calopacket = findNode::getClass<CaloPacket>(topNode, pid);
0589       process_packet(calopacket, pid);
0590     }
0591   }
0592 
0593   return Fun4AllReturnCodes::EVENT_OK;
0594 }
0595 
0596 bool CaloFittingQA::skipChannel(int ich, int pid, CaloTowerDefs::DetectorSystem dettype)
0597 {
0598   if (dettype == CaloTowerDefs::SEPD)
0599   {
0600     int sector = ((ich + 1) / 32);
0601     int emptych = -999;
0602     if ((sector == 0) && (pid == 9001))
0603     {
0604       emptych = 1;
0605     }
0606     else
0607     {
0608       emptych = 14 + 32 * sector;
0609     }
0610     if (ich == emptych)
0611     {
0612       return true;
0613     }
0614   }
0615 
0616   if (dettype == CaloTowerDefs::ZDC)
0617   {
0618     if (((ich > 17) && (ich < 48)) || ((ich > 63) && (ich < 80)) || ((ich > 81) && (ich < 112)))
0619     {
0620       return true;
0621     }
0622   }
0623 
0624   return false;
0625 }
0626 
0627 int CaloFittingQA::End(PHCompositeNode* /*unused*/)
0628 {
0629   return Fun4AllReturnCodes::EVENT_OK;
0630 }
0631 
0632 std::string CaloFittingQA::getHistoPrefix() const { return std::string("h_") + Name() + std::string("_"); }
0633 
0634 void CaloFittingQA::createHistos()
0635 {
0636   auto* hm = QAHistManagerDef::getHistoManager();
0637   assert(hm);
0638 
0639   // create and register your histos (all types) here
0640   h_cemc_etaphi_ZScrosscalib = new TProfile2D(std::format("{}cemc_etaphi_ZScrosscalib", getHistoPrefix()).c_str(), ";eta;phi", 96, 0, 96, 256, 0, 256, -10, 10);
0641   h_cemc_etaphi_ZScrosscalib->SetDirectory(nullptr);
0642   hm->registerHisto(h_cemc_etaphi_ZScrosscalib);
0643 
0644   h_ihcal_etaphi_ZScrosscalib = new TProfile2D(std::format("{}ihcal_etaphi_ZScrosscalib", getHistoPrefix()).c_str(), ";eta;phi", 24, 0, 24, 64, 0, 64, -10, 10);
0645   h_ihcal_etaphi_ZScrosscalib->SetDirectory(nullptr);
0646   hm->registerHisto(h_ihcal_etaphi_ZScrosscalib);
0647 
0648   h_ohcal_etaphi_ZScrosscalib = new TProfile2D(std::format("{}ohcal_etaphi_ZScrosscalib", getHistoPrefix()).c_str(), ";eta;phi", 24, 0, 24, 64, 0, 64, -10, 10);
0649   h_ohcal_etaphi_ZScrosscalib->SetDirectory(nullptr);
0650   hm->registerHisto(h_ohcal_etaphi_ZScrosscalib);
0651 
0652   h_cemc_etaphi_pedestal = new TProfile2D(std::format("{}cemc_etaphi_pedestal", getHistoPrefix()).c_str(), ";eta;phi", 96, 0, 96, 256, 0, 256, 0, 16400);
0653   h_cemc_etaphi_pedestal->SetErrorOption("s");
0654   h_cemc_etaphi_pedestal->SetDirectory(nullptr);
0655   hm->registerHisto(h_cemc_etaphi_pedestal);
0656 
0657   h_ihcal_etaphi_pedestal = new TProfile2D(std::format("{}ihcal_etaphi_pedestal", getHistoPrefix()).c_str(), ";eta;phi", 24, 0, 24, 64, 0, 64, 0, 16400);
0658   h_ihcal_etaphi_pedestal->SetErrorOption("s");
0659   h_ihcal_etaphi_pedestal->SetDirectory(nullptr);
0660   hm->registerHisto(h_ihcal_etaphi_pedestal);
0661 
0662   h_ohcal_etaphi_pedestal = new TProfile2D(std::format("{}ohcal_etaphi_pedestal", getHistoPrefix()).c_str(), ";eta;phi", 24, 0, 24, 64, 0, 64, 0, 16400);
0663   h_ohcal_etaphi_pedestal->SetErrorOption("s");
0664   h_ohcal_etaphi_pedestal->SetDirectory(nullptr);
0665   hm->registerHisto(h_ohcal_etaphi_pedestal);
0666 
0667   h_cemc_zs_frac_vs_multiplicity = new TH2F(std::format("{}cemc_zs_frac_vs_multiplicity", getHistoPrefix()).c_str(), ";Nhit > 0.3 GeV;ZS fraction (%)", 2700, 0, 27648, 100, 0, 1);
0668   h_cemc_zs_frac_vs_multiplicity->SetDirectory(nullptr);
0669   hm->registerHisto(h_cemc_zs_frac_vs_multiplicity);
0670 
0671   h_ihcal_zs_frac_vs_multiplicity = new TH2F(std::format("{}ihcal_zs_frac_vs_multiplicity", getHistoPrefix()).c_str(), ";Nhit > 0.3 GeV;ZS fraction (%)", 2700, 0, 27648, 100, 0, 1);
0672   h_ihcal_zs_frac_vs_multiplicity->SetDirectory(nullptr);
0673   hm->registerHisto(h_ihcal_zs_frac_vs_multiplicity);
0674 
0675   h_ohcal_zs_frac_vs_multiplicity = new TH2F(std::format("{}ohcal_zs_frac_vs_multiplicity", getHistoPrefix()).c_str(), ";Nhit > 0.3 GeV;ZS fraction (%)", 2700, 0, 27648, 100, 0, 1);
0676   h_ohcal_zs_frac_vs_multiplicity->SetDirectory(nullptr);
0677   hm->registerHisto(h_ohcal_zs_frac_vs_multiplicity);
0678 
0679   h_packet_events = new TH1I(std::format("{}packet_events", getHistoPrefix()).c_str(), ";packet id", 6010, 6000, 12010);
0680   h_packet_events->SetDirectory(nullptr);
0681   hm->registerHisto(h_packet_events);
0682 
0683   h_empty_packets = new TH1I(std::format("{}empty_packets", getHistoPrefix()).c_str(), ";packet id", 6010, 6000, 12010);
0684   h_empty_packets->SetDirectory(nullptr);
0685   hm->registerHisto(h_empty_packets);
0686 
0687   h_missing_packets = new TH1I(std::format("{}missing_packets", getHistoPrefix()).c_str(), ";packet id", 6010, 6000, 12010);
0688   h_missing_packets->SetDirectory(nullptr);
0689   hm->registerHisto(h_missing_packets);
0690 }