#include <msegala/ClusterSummary/src/ClusterAnalyzer.cc>
Public Member Functions | |
ClusterAnalyzer (const edm::ParameterSet &) | |
~ClusterAnalyzer () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
Private Attributes | |
edm::InputTag | _class |
bool | _firstPass |
bool | _verbose |
std::vector< double > | clusterCharge_ |
std::vector< double > | clusterSize_ |
bool | doPixels |
bool | doStrips |
std::map< int, std::string > | enumModules_ |
edm::Service< TFileService > | fs |
std::vector< std::vector < double > > | genericVariables_ |
std::map< std::string, TH1D * > | histos1D_ |
std::vector< string > | maps |
std::vector< int > | modules_ |
std::vector< int > | nType_ |
std::string | ProvInfo |
std::string | ProvInfo_vars |
std::string | ProvInfoPixels |
std::string | ProvInfoPixels_vars |
std::vector< std::string > | v_moduleTypes |
std::vector< std::string > | v_variables |
Description: [one line class summary]
Implementation: [Notes on implementation]
Definition at line 49 of file ClusterAnalyzer.cc.
ClusterAnalyzer::ClusterAnalyzer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 94 of file ClusterAnalyzer.cc.
References edm::ParameterSet::getParameter().
{ _class = iConfig.getParameter<edm::InputTag>("clusterSum"); _firstPass = true; _verbose = true; //set to true to see the event by event summary info }
ClusterAnalyzer::~ClusterAnalyzer | ( | ) |
Definition at line 105 of file ClusterAnalyzer.cc.
{}
void ClusterAnalyzer::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 108 of file ClusterAnalyzer.cc.
References begin, hitfit::clear(), gather_cfg::cout, clustersummaryproducer_cfg::doPixels, clustersummaryproducer_cfg::doStrips, end, HcalObjRepresent::Fill(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), edm::getParameterSet(), edm::Event::getProvenance(), text2workspace::mod, n, and edm::Provenance::psetID().
{ using namespace edm; Handle< ClusterSummary > class_; iEvent.getByLabel( _class, class_); if (_firstPass){ modules_ . clear(); modules_ = class_ -> GetUserModules(); // Provenance Information const Provenance& prov = iEvent.getProvenance(class_.id()); edm::ParameterSet pSet=getParameterSet( prov.psetID() ); ProvInfo = ""; ProvInfo_vars = ""; ProvInfoPixels = ""; ProvInfoPixels_vars = ""; std::string ProvString = ""; std::string VarString = ""; doStrips = pSet.getParameter<bool>("doStrips"); doPixels = pSet.getParameter<bool>("doPixels"); if (doStrips){ ProvInfo = pSet.getParameter<string>("stripModule"); cout << "From provenance infomation the selected strip modules are = "<< ProvInfo << endl; ProvInfo_vars = pSet.getParameter<string>("stripVariables"); cout << "From provenance infomation the avaliable strip variables are = "<< ProvInfo_vars << endl; } if (doPixels){ ProvInfoPixels = pSet.getParameter<string>("pixelModule"); cout << "From provenance infomation the selected pixel modules are = "<< ProvInfoPixels << endl; ProvInfoPixels_vars = pSet.getParameter<string>("pixelVariables"); cout << "From provenance infomation the avaliable pixel variables are = "<< ProvInfoPixels_vars << endl; } if (doStrips && doPixels) { ProvString = ProvInfo + "," + ProvInfoPixels; VarString = ProvInfo_vars + "," + ProvInfoPixels_vars; } else if (doStrips && !doPixels) { ProvString = ProvInfo; VarString = ProvInfo_vars; } else if (!doStrips && doPixels) { ProvString = ProvInfoPixels; VarString = ProvInfoPixels_vars; } // Define the Modules to get the summary info out of v_moduleTypes = class_ -> DecodeProvInfo( ProvString ); v_variables = class_ -> DecodeProvInfo( VarString ); } class_ -> SetUserContent( v_variables ); genericVariables_ = class_ -> GetGenericVariable(); //cout << class_ -> GetGenericVariable("cHits", ClusterSummary::TIB) << endl; if ( _firstPass ){ //only do on the first event // Loop over all the modules to create a Map of Histograms to fill int n = 0; for ( vector<int>::const_iterator mod = modules_ . begin(); mod != modules_ . end(); mod++ ){ //cout << "Creating histograms for " << *mod << endl; cout << "Creating histograms for " << v_moduleTypes.at(n) << endl; std::string tmpstr = v_moduleTypes.at(n); histos1D_[ (tmpstr + "nclusters").c_str() ] = fs->make< TH1D >( (tmpstr + "nclusters").c_str() , (tmpstr + "nclusters").c_str() , 1000 , 0 , 3000 ); histos1D_[ (tmpstr + "nclusters").c_str() ]->SetXTitle( ("number of Clusters in " + tmpstr).c_str() ); histos1D_[ (tmpstr + "avgCharge").c_str() ] = fs->make< TH1D >( (tmpstr + "avgCharge").c_str() , (tmpstr + "avgCharge").c_str() , 500 , 0 , 1000 ); histos1D_[ (tmpstr + "avgCharge").c_str() ]->SetXTitle( ("average cluster charge in " + tmpstr).c_str() ); histos1D_[ (tmpstr + "avgSize").c_str() ] = fs->make< TH1D >( (tmpstr + "avgSize").c_str() , (tmpstr + "avgSize").c_str() , 30 , 0 , 10 ); histos1D_[ (tmpstr + "avgSize").c_str() ]->SetXTitle( ("average cluster size in " + tmpstr).c_str() ); maps.push_back( (tmpstr + "nclusters").c_str() ); maps.push_back( (tmpstr + "avgSize").c_str() ); maps.push_back( (tmpstr + "avgCharge").c_str() ); ++n; } _firstPass = false; } int n = 0; for ( vector<int>::const_iterator mod = modules_ . begin(); mod != modules_ . end(); mod++ ){ std::string tmpstr = v_moduleTypes.at(n); //Trick to see if it comes from a strip or pixel variable. If the first digit is < 6 then it is from the strips. int mod_tmp = *mod; while (mod_tmp > 9 ){ mod_tmp /= 10; } if ( mod_tmp < 5 ){ histos1D_[ (tmpstr + "nclusters").c_str() ] -> Fill( class_ -> GetGenericVariable("cHits", *mod) ); histos1D_[ (tmpstr + "avgSize").c_str() ] -> Fill( class_ -> GetGenericVariable("cSize", *mod) /class_ -> GetGenericVariable("cHits", *mod) ); histos1D_[ (tmpstr + "avgCharge").c_str() ] -> Fill( class_ -> GetGenericVariable("cCharge", *mod)/class_ -> GetGenericVariable("cHits", *mod) ); cout << "n"<<tmpstr <<", avg size, avg charge = "<< class_ -> GetGenericVariable( "cHits",*mod ); cout << ", "<< class_ -> GetGenericVariable( "cSize",*mod ) /class_ -> GetGenericVariable( "cHits",*mod ); cout << ", "<< class_ -> GetGenericVariable( "cCharge",*mod )/class_ -> GetGenericVariable( "cHits",*mod ) << endl; } else{ histos1D_[ (tmpstr + "nclusters").c_str() ] -> Fill( class_ -> GetGenericVariable("pHits", *mod) ); histos1D_[ (tmpstr + "avgSize").c_str() ] -> Fill( class_ -> GetGenericVariable("pSize", *mod)/class_ -> GetGenericVariable("pHits", *mod) ); histos1D_[ (tmpstr + "avgCharge").c_str() ] -> Fill( class_ -> GetGenericVariable("pCharge", *mod)/class_ -> GetGenericVariable("pHits", *mod) ); cout << "n"<<tmpstr <<", avg size, avg charge = "<< class_ -> GetGenericVariable( "pHits",*mod ); cout << ", "<< class_ -> GetGenericVariable( "pSize",*mod ) /class_ -> GetGenericVariable( "pHits",*mod ); cout << ", "<< class_ -> GetGenericVariable( "pCharge",*mod )/class_ -> GetGenericVariable( "pHits",*mod ) << endl; } ++n; } cout << "-------------------------------------------------------" << endl; }
void ClusterAnalyzer::beginJob | ( | void | ) | [private, virtual] |
edm::InputTag ClusterAnalyzer::_class [private] |
Definition at line 62 of file ClusterAnalyzer.cc.
bool ClusterAnalyzer::_firstPass [private] |
Definition at line 78 of file ClusterAnalyzer.cc.
bool ClusterAnalyzer::_verbose [private] |
Definition at line 82 of file ClusterAnalyzer.cc.
std::vector<double> ClusterAnalyzer::clusterCharge_ [private] |
Definition at line 71 of file ClusterAnalyzer.cc.
std::vector<double> ClusterAnalyzer::clusterSize_ [private] |
Definition at line 70 of file ClusterAnalyzer.cc.
bool ClusterAnalyzer::doPixels [private] |
Definition at line 90 of file ClusterAnalyzer.cc.
bool ClusterAnalyzer::doStrips [private] |
Definition at line 89 of file ClusterAnalyzer.cc.
std::map<int, std::string> ClusterAnalyzer::enumModules_ [private] |
Definition at line 64 of file ClusterAnalyzer.cc.
edm::Service<TFileService> ClusterAnalyzer::fs [private] |
Definition at line 79 of file ClusterAnalyzer.cc.
std::vector< std::vector<double> > ClusterAnalyzer::genericVariables_ [private] |
Definition at line 76 of file ClusterAnalyzer.cc.
std::map< std::string, TH1D* > ClusterAnalyzer::histos1D_ [private] |
Definition at line 65 of file ClusterAnalyzer.cc.
std::vector<string> ClusterAnalyzer::maps [private] |
Definition at line 80 of file ClusterAnalyzer.cc.
std::vector<int> ClusterAnalyzer::modules_ [private] |
Definition at line 67 of file ClusterAnalyzer.cc.
std::vector<int> ClusterAnalyzer::nType_ [private] |
Definition at line 69 of file ClusterAnalyzer.cc.
std::string ClusterAnalyzer::ProvInfo [private] |
Definition at line 84 of file ClusterAnalyzer.cc.
std::string ClusterAnalyzer::ProvInfo_vars [private] |
Definition at line 85 of file ClusterAnalyzer.cc.
std::string ClusterAnalyzer::ProvInfoPixels [private] |
Definition at line 86 of file ClusterAnalyzer.cc.
std::string ClusterAnalyzer::ProvInfoPixels_vars [private] |
Definition at line 87 of file ClusterAnalyzer.cc.
std::vector<std::string> ClusterAnalyzer::v_moduleTypes [private] |
Definition at line 73 of file ClusterAnalyzer.cc.
std::vector<std::string> ClusterAnalyzer::v_variables [private] |
Definition at line 74 of file ClusterAnalyzer.cc.