#include "UserAlg.h" #include "RunStatisticsAlg.h" #include #include #include #include #include "TROOT.h" #include "TStyle.h" #include "TH1F.h" #include "TCanvas.h" using std::cout; using std::endl; using std::map; using std::vector; UserAlg::UserAlg(Event* event, Geometry* geo, Headers* runHeader):SystemAlg( event,geo,runHeader){ m_event = event; m_geo = geo; m_runHeader = runHeader; // create the new System Alg Objects m_occupancy = new OccupancyAlg(m_event, m_geo, m_runHeader); RunStatisticsAlg* m_runstatistics = new RunStatisticsAlg(m_event, m_geo, m_runHeader); vector algVector; algVector.push_back(m_occupancy); algVector.push_back(m_runstatistics); SystemAlg::setAlgs(algVector); } // initialize any variables here bool UserAlg::initialize(){ SystemAlg::initialize(); //do NOT remove this line // set the occupancy cut for the list of channels // channels are kept if their occupancy is > occCut float occCut = 0.1; // hec // read occupancy file int hecRunNo = m_occupancy->hecReadOccupancyFile("hec_12253_occupancy.dat"); // get the occupancy map map hecOccMap = m_occupancy->hecOccupancyMap(); // fill a febno keyed map of occupancy for the cluster map hecOccClusterMap; for (map::iterator it = hecOccMap.begin(); it != hecOccMap.end(); ++it) { int febno = it->first; float occupancy = it->second; if (occupancy > occCut) hecOccClusterMap[febno] = occupancy; } // draw { std::ostringstream os; os << "occupancy > " << occCut << " run " << hecRunNo; m_geo->draw2DHec(hecOccClusterMap, 0, false, 0, 0, os.str()); } // emec // read occupancy file int emecRunNo = m_occupancy->emecReadOccupancyFile("emech_12253_occupancy.dat"); // get the occupancy map map emecOccMap = m_occupancy->emecOccupancyMap(); // fill a febno keyed map of occupancy for the cluster map emecOccClusterMap; for (map::iterator it = emecOccMap.begin(); it != emecOccMap.end(); ++it) { int febno = it->first; float occupancy = it->second; if (occupancy > occCut) emecOccClusterMap[febno] = occupancy; } // draw { std::ostringstream os; os << "occupancy > " << occCut << " run " << emecRunNo; m_geo->draw2DEmec(emecOccClusterMap, 0, false, 0, 0, os.str()); } return true; } // put any code you want executed per event here bool UserAlg::execute(){ SystemAlg::execute(); //do NOT remove this line return true; } //put any code here that you want executed after all the events have been processed. bool UserAlg::finalize(){ SystemAlg::finalize();//do NOT remove this line return true; }