#include "UserAlg.h" #include "RunStatisticsAlg.h" #include #include #include #include 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_noise = new NoiseAlg(m_event, m_geo, m_runHeader); RunStatisticsAlg* m_runstatistics = new RunStatisticsAlg(m_event, m_geo, m_runHeader); vector algVector; algVector.push_back(m_noise); algVector.push_back(m_runstatistics); SystemAlg::setAlgs(algVector); } // initialize any variables here bool UserAlg::initialize(){ SystemAlg::initialize(); //do NOT remove this line // hec // enable the noise computation m_noise->hecEnable("/afs/cern.ch/user/h/hectbmon/public/tb/aug02/dig/coeff_hec_aug02_020903.dat"); // set print level m_noise->hecPrintLevel(1); // emec // enable the noise computation m_noise->emecEnable("/afs/cern.ch/user/h/hectbmon/public/tb/aug02/dig/coeff_emec_high_aug02_020903.dat"); // set print level m_noise->emecPrintLevel(1); 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 // fill a febno keyed map of the log10 of the hec noise. // only consider the cases where the noise is greater than 0. map hecNoiseMap = m_noise->hecNoiseMap(); map hecLogNoiseMap; for (map::iterator it = hecNoiseMap.begin(); it != hecNoiseMap.end(); ++it) { int febno = it->first; float noise = it->second; if (noise > 0.) hecLogNoiseMap[febno] = log10(noise); } // fill a febno keyed map of the log10 of the emec noise. // only consider the cases where the noise is greater than 0. map emecNoiseMap = m_noise->emecNoiseMap(); map emecLogNoiseMap; for (map::iterator it = emecNoiseMap.begin(); it != emecNoiseMap.end(); ++it) { int febno = it->first; float noise = it->second; if (noise > 0.) emecLogNoiseMap[febno] = log10(noise); } // draw m_geo->draw2DHecDetail(hecLogNoiseMap, 0, false, 0, 0, "log10(noise(nA))"); m_geo->draw2DEmecDetail(emecLogNoiseMap, 0, false, 0, 0, "log10(noise(nA))"); return true; }