CMS 3D CMS Logo

HcalPedestalAnalysis Class Reference

#include <CalibCalorimetry/HcalAlgos/interface/HcalPedestalAnalysis.h>

List of all members.

Public Member Functions

int done (const HcalPedestals *fInputPedestals, const HcalPedestalWidths *fInputWidths, HcalPedestals *fOutputPedestals, HcalPedestalWidths *fOutputWidths)
 HcalPedestalAnalysis (const edm::ParameterSet &ps)
 Constructor.
void processEvent (const HBHEDigiCollection &hbhe, const HODigiCollection &ho, const HFDigiCollection &hf, const HcalDbService &cond)
void SampleAnalysis ()
void setup (const std::string &m_outputFileROOT)
 ~HcalPedestalAnalysis ()
 Destructor.

Static Public Member Functions

static int HcalPedVal (int nstat[4], const HcalPedestals *fRefPedestals, const HcalPedestalWidths *fRefPedestalWidths, HcalPedestals *fRawPedestals, HcalPedestalWidths *fRawPedestalWidths, HcalPedestals *fValPedestals, HcalPedestalWidths *fValPedestalWidths)

Private Types

typedef std::pair< TH1F *,
std::pair< std::map< int,
std::vector< double > >,
std::vector< TH1F * > > > 
PEDBUNCH

Private Member Functions

void AllChanHists (const HcalDetId detid, const HcalQIESample &qie0, const HcalQIESample &qie1, const HcalQIESample &qie2, const HcalQIESample &qie3, const HcalQIESample &qie4, const HcalQIESample &qie5, std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT)
void GetPedConst (std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, TH1F *PedMeans, TH1F *PedWidths)
void per2CapsHists (int flag, int id, const HcalDetId detid, const HcalQIESample &qie1, const HcalQIESample &qie2, std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, const HcalDbService &cond)
void Trendings (std::map< HcalDetId, std::map< int, PEDBUNCH > > &toolT, TH1F *Chi2, TH1F *CapidAverage, TH1F *CapidChi2)

Private Attributes

std::map< HcalDetId, std::map
< int, PEDBUNCH > >::iterator 
_meot
int evt
int evt_curr
HcalPedestalsfRawPedestals
HcalPedestalWidthsfRawPedestalWidths
const HcalPedestalsfRefPedestals
const HcalPedestalWidthsfRefPedestalWidths
HcalPedestalsfValPedestals
HcalPedestalWidthsfValPedestalWidths
struct {
   TH1F *   ALLPEDS
   TH1F *   CAPID_AVERAGE
   TH1F *   CAPID_CHI2
   TH1F *   CHI2
   TH1F *   PEDMEAN
   TH1F *   PEDRMS
   std::map< HcalDetId, std::map
< int, PEDBUNCH > >   PEDTRENDS
hbHists
struct {
   TH1F *   ALLPEDS
   TH1F *   CAPID_AVERAGE
   TH1F *   CAPID_CHI2
   TH1F *   CHI2
   TH1F *   PEDMEAN
   TH1F *   PEDRMS
   std::map< HcalDetId, std::map
< int, PEDBUNCH > >   PEDTRENDS
hfHists
struct {
   TH1F *   ALLPEDS
   TH1F *   CAPID_AVERAGE
   TH1F *   CAPID_CHI2
   TH1F *   CHI2
   TH1F *   PEDMEAN
   TH1F *   PEDRMS
   std::map< HcalDetId, std::map
< int, PEDBUNCH > >   PEDTRENDS
hoHists
int m_AllPedsOK
const HcalQIECoderm_coder
int m_endTS
TFile * m_file
int m_hiSaveflag
std::ofstream m_logFile
int m_nevtsample
std::string m_outputFileMean
std::string m_outputFileROOT
std::string m_outputFileWidth
int m_pedsinADC
int m_pedValflag
const HcalQIEShapem_shape
int m_startTS
float m_stat [4]
int sample
std::vector< boolstate

Static Private Attributes

static const int fitflag = 0


Detailed Description

Definition at line 37 of file HcalPedestalAnalysis.h.


Member Typedef Documentation

typedef std::pair<TH1F*,std::pair<std::map<int, std::vector<double> >,std::vector<TH1F*> > > HcalPedestalAnalysis::PEDBUNCH [private]

Definition at line 89 of file HcalPedestalAnalysis.h.


Constructor & Destructor Documentation

HcalPedestalAnalysis::HcalPedestalAnalysis ( const edm::ParameterSet ps  ) 

Constructor.

Definition at line 16 of file HcalPedestalAnalysis.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), evt, edm::ParameterSet::getUntrackedParameter(), hbHists, hfHists, hoHists, i, k, m_AllPedsOK, m_endTS, m_file, m_hiSaveflag, m_nevtsample, m_outputFileMean, m_outputFileROOT, m_outputFileWidth, m_pedsinADC, m_pedValflag, m_startTS, m_stat, sample, and state.

00017   : fRefPedestals (0),
00018     fRefPedestalWidths (0),
00019     fRawPedestals (0),
00020     fRawPedestalWidths (0),
00021     fValPedestals (0),
00022     fValPedestalWidths (0)
00023 {
00024   evt=0;
00025   sample=0;
00026   m_file=0;
00027   m_AllPedsOK=0;
00028   for(int i=0; i<4; i++) m_stat[i]=0;
00029   for(int k=0;k<4;k++) state.push_back(true);
00030 
00031 // user cfg parameters
00032   m_outputFileMean = ps.getUntrackedParameter<string>("outputFileMeans", "");
00033   if ( m_outputFileMean.size() != 0 ) {
00034     cout << "Hcal pedestal means will be saved to " << m_outputFileMean.c_str() << endl;
00035   } 
00036   m_outputFileWidth = ps.getUntrackedParameter<string>("outputFileWidths", "");
00037   if ( m_outputFileWidth.size() != 0 ) {
00038     cout << "Hcal pedestal widths will be saved to " << m_outputFileWidth.c_str() << endl;
00039   } 
00040   m_outputFileROOT = ps.getUntrackedParameter<string>("outputFileHist", "");
00041   if ( m_outputFileROOT.size() != 0 ) {
00042     cout << "Hcal pedestal histograms will be saved to " << m_outputFileROOT.c_str() << endl;
00043   } 
00044   m_nevtsample = ps.getUntrackedParameter<int>("nevtsample",0);
00045 // for compatibility with previous versions
00046   if(m_nevtsample==9999999) m_nevtsample=0;
00047   m_pedsinADC = ps.getUntrackedParameter<int>("pedsinADC",0);
00048   m_hiSaveflag = ps.getUntrackedParameter<int>("hiSaveflag",0);
00049   m_pedValflag = ps.getUntrackedParameter<int>("pedValflag",0);
00050   if(m_pedValflag<0) m_pedValflag=0;
00051   if (m_nevtsample>0 && m_pedValflag>0) {
00052     cout<<"WARNING - incompatible cfg options: nevtsample = "<<m_nevtsample<<", pedValflag = "<<m_pedValflag<<endl;
00053     cout<<"Setting pedValflag = 0"<<endl;
00054     m_pedValflag=0;
00055   }
00056   if(m_pedValflag>1) m_pedValflag=1;
00057   m_startTS = ps.getUntrackedParameter<int>("firstTS", 0);
00058   if(m_startTS<0) m_startTS=0;
00059   m_endTS = ps.getUntrackedParameter<int>("lastTS", 9);
00060 
00061 //  m_logFile.open("HcalPedestalAnalysis.log");
00062 
00063   hbHists.ALLPEDS = new TH1F("HBHE All Pedestals","HBHE All Peds",10,0,9);
00064   hbHists.PEDRMS= new TH1F("HBHE All Pedestal Widths","HBHE All Pedestal RMS",100,0,3);
00065   hbHists.PEDMEAN= new TH1F("HBHE All Pedestal Means","HBHE All Pedestal Means",100,0,9);
00066   hbHists.CHI2= new TH1F("HBHE Chi2/ndf for whole range Gauss fit","HBHE Chi2/ndf Gauss",200,0.,50.);
00067 
00068   hoHists.ALLPEDS = new TH1F("HO All Pedestals","HO All Peds",10,0,9);
00069   hoHists.PEDRMS= new TH1F("HO All Pedestal Widths","HO All Pedestal RMS",100,0,3);
00070   hoHists.PEDMEAN= new TH1F("HO All Pedestal Means","HO All Pedestal Means",100,0,9);
00071   hoHists.CHI2= new TH1F("HO Chi2/ndf for whole range Gauss fit","HO Chi2/ndf Gauss",200,0.,50.);
00072 
00073   hfHists.ALLPEDS = new TH1F("HF All Pedestals","HF All Peds",10,0,9);
00074   hfHists.PEDRMS= new TH1F("HF All Pedestal Widths","HF All Pedestal RMS",100,0,3);
00075   hfHists.PEDMEAN= new TH1F("HF All Pedestal Means","HF All Pedestal Means",100,0,9);
00076   hfHists.CHI2= new TH1F("HF Chi2/ndf for whole range Gauss fit","HF Chi2/ndf Gauss",200,0.,50.);
00077 }

HcalPedestalAnalysis::~HcalPedestalAnalysis (  ) 

Destructor.

Definition at line 80 of file HcalPedestalAnalysis.cc.

References _meot, hbHists, hfHists, hoHists, and i.

00080                                            {
00081 
00082   for(_meot=hbHists.PEDTRENDS.begin(); _meot!=hbHists.PEDTRENDS.end(); _meot++){
00083     for(int i=0; i<16; i++) _meot->second[i].first->Delete();
00084   }
00085   for(_meot=hoHists.PEDTRENDS.begin(); _meot!=hoHists.PEDTRENDS.end(); _meot++){
00086     for(int i=0; i<16; i++) _meot->second[i].first->Delete();
00087   }
00088   for(_meot=hfHists.PEDTRENDS.begin(); _meot!=hfHists.PEDTRENDS.end(); _meot++){
00089     for(int i=0; i<16; i++) _meot->second[i].first->Delete();
00090   }
00091   hbHists.ALLPEDS->Delete();
00092   hbHists.PEDRMS->Delete();
00093   hbHists.PEDMEAN->Delete();
00094   hbHists.CHI2->Delete();
00095 
00096   hoHists.ALLPEDS->Delete();
00097   hoHists.PEDRMS->Delete();
00098   hoHists.PEDMEAN->Delete();
00099   hoHists.CHI2->Delete();
00100 
00101   hfHists.ALLPEDS->Delete();
00102   hfHists.PEDRMS->Delete();
00103   hfHists.PEDMEAN->Delete();
00104   hfHists.CHI2->Delete();
00105 }


Member Function Documentation

void HcalPedestalAnalysis::AllChanHists ( const HcalDetId  detid,
const HcalQIESample qie0,
const HcalQIESample qie1,
const HcalQIESample qie2,
const HcalQIESample qie3,
const HcalQIESample qie4,
const HcalQIESample qie5,
std::map< HcalDetId, std::map< int, PEDBUNCH > > &  toolT 
) [private]

Referenced by processEvent().

int HcalPedestalAnalysis::done ( const HcalPedestals fInputPedestals,
const HcalPedestalWidths fInputWidths,
HcalPedestals fOutputPedestals,
HcalPedestalWidths fOutputWidths 
)

Definition at line 501 of file HcalPedestalAnalysis.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), evt, fRawPedestals, fRawPedestalWidths, fRefPedestals, fRefPedestalWidths, fValPedestals, fValPedestalWidths, hbHists, HcalPedVal(), hfHists, hoHists, m_AllPedsOK, m_file, m_nevtsample, m_outputFileROOT, m_pedValflag, m_stat, SampleAnalysis(), and Trendings().

Referenced by HcalPedestalAnalyzer::endJob().

00505 {
00506    int nstat[4];
00507 
00508 // Pedestal objects
00509   // inputs...
00510   fRefPedestals = fInputPedestals;
00511   fRefPedestalWidths = fInputPedestalWidths;
00512   
00513   // outputs...
00514   if(m_pedValflag>0) {
00515     fValPedestals = fOutputPedestals;
00516     fValPedestalWidths = fOutputPedestalWidths;
00517     fRawPedestals = new HcalPedestals();
00518     fRawPedestalWidths = new HcalPedestalWidths();
00519   }
00520   else {
00521     fRawPedestals = fOutputPedestals;
00522     fRawPedestalWidths = fOutputPedestalWidths;
00523     fValPedestals = new HcalPedestals();
00524     fValPedestalWidths = new HcalPedestalWidths();
00525   }
00526 
00527 // compute pedestal constants
00528   if(m_nevtsample<1) SampleAnalysis();
00529   if(m_nevtsample>0) {
00530     if(evt%m_nevtsample!=0) SampleAnalysis();
00531   }
00532 
00533 // trending histos
00534   if(m_nevtsample>0){
00535     m_file->cd();
00536     m_file->cd("HB");
00537     Trendings(hbHists.PEDTRENDS,hbHists.CHI2,hbHists.CAPID_AVERAGE,hbHists.CAPID_CHI2);
00538     m_file->cd();
00539     m_file->cd("HO");
00540     Trendings(hoHists.PEDTRENDS,hoHists.CHI2,hoHists.CAPID_AVERAGE,hoHists.CAPID_CHI2);
00541     m_file->cd();
00542     m_file->cd("HF");
00543     Trendings(hfHists.PEDTRENDS,hfHists.CHI2,hfHists.CAPID_AVERAGE,hfHists.CAPID_CHI2);
00544   }
00545 
00546   if (m_nevtsample<1) {
00547 
00548 // pedestal validation: m_AllPedsOK=-1 means not validated,
00549 //                                   0 everything OK,
00550 //                                   N>0 : mod(N,100000) drifts + width changes
00551 //                                         int(N/100000) missing channels
00552     m_AllPedsOK=-1;
00553     if(m_pedValflag>0) {
00554       for (int i=0; i<4; i++) nstat[i]=(int)m_stat[i];
00555       int NPedErrors=HcalPedVal(nstat,fRefPedestals,fRefPedestalWidths,
00556                             fRawPedestals,fRawPedestalWidths,
00557                             fValPedestals,fValPedestalWidths);
00558       m_AllPedsOK=NPedErrors;
00559     }
00560 // setting m_AllPedsOK=-2 will inhibit writing pedestals out
00561 //    if(m_pedValflag==1){
00562 //      if(evt<100)m_AllPedsOK=-2;
00563 //    }
00564 
00565   }
00566 
00567   // Write other histograms.
00568   // HB
00569   m_file->cd();
00570   m_file->cd("HB");
00571   hbHists.ALLPEDS->Write();
00572   hbHists.PEDRMS->Write();
00573   hbHists.PEDMEAN->Write();
00574   // HO
00575   m_file->cd();
00576   m_file->cd("HO");
00577   hoHists.ALLPEDS->Write();
00578   hoHists.PEDRMS->Write();
00579   hoHists.PEDMEAN->Write();
00580   // HF
00581   m_file->cd();
00582   m_file->cd("HF");
00583   hfHists.ALLPEDS->Write();
00584   hfHists.PEDRMS->Write();
00585   hfHists.PEDMEAN->Write();
00586 
00587   m_file->Close();
00588   cout << "Hcal histograms written to " << m_outputFileROOT.c_str() << endl;
00589   return (int)m_AllPedsOK;
00590 }

void HcalPedestalAnalysis::GetPedConst ( std::map< HcalDetId, std::map< int, PEDBUNCH > > &  toolT,
TH1F *  PedMeans,
TH1F *  PedWidths 
) [private]

Referenced by SampleAnalysis().

int HcalPedestalAnalysis::HcalPedVal ( int  nstat[4],
const HcalPedestals fRefPedestals,
const HcalPedestalWidths fRefPedestalWidths,
HcalPedestals fRawPedestals,
HcalPedestalWidths fRawPedestalWidths,
HcalPedestals fValPedestals,
HcalPedestalWidths fValPedestalWidths 
) [static]

Definition at line 748 of file HcalPedestalAnalysis.cc.

References TestMuL1L2Filter_cff::cerr, lat::endl(), HcalForward, int, HcalPedestalWidth::setSigma(), funct::sqrt(), and width.

Referenced by done(), and main().

00754 {
00755 // new version of pedestal validation - it is designed to be as independent of
00756 // all the rest as possible - you only need to provide valid pedestal objects
00757 // and a vector of statistics per capID to use this as standalone code
00758   HcalDetId detid;
00759   float RefPedVals[4]; float RefPedSigs[4][4];
00760   float RawPedVals[4]; float RawPedSigs[4][4];
00761   map<HcalDetId,bool> isinRaw;
00762   map<HcalDetId,bool> isinRef;
00763   std::vector<DetId> RefChanns=fRefPedestals->getAllChannels();
00764   std::vector<DetId> RawChanns=fRawPedestals->getAllChannels();
00765   std::ofstream PedValLog;
00766   PedValLog.open("HcalPedVal.log");
00767 
00768   if(nstat[0]+nstat[1]+nstat[2]+nstat[3]<2500) PedValLog<<"HcalPedVal: warning - low statistics"<<std::endl;
00769 // find complete list of channels in current data and reference
00770   for (int i=0; i<(int)RawChanns.size(); i++){
00771     isinRef[HcalDetId(RawChanns[i])]=false;
00772   }
00773   for (int i=0; i<(int)RefChanns.size(); i++){
00774     detid=HcalDetId(RefChanns[i]);
00775     isinRaw[detid]=false;
00776     isinRef[detid]=true;
00777   }
00778   for (int i=0; i<(int)RawChanns.size(); i++){
00779     detid=HcalDetId(RawChanns[i]);
00780     isinRaw[detid]=true;
00781     if (isinRef[detid]==false) {
00782       PedValLog<<"HcalPedVal: channel "<<detid<<" not found in reference set"<<std::endl;
00783       std::cerr<<"HcalPedVal: channel "<<detid<<" not found in reference set"<<std::endl;
00784     }
00785   }
00786 
00787 // main loop over channels
00788   int erflag=0;
00789   for (int i=0; i<(int)RefChanns.size(); i++){
00790     detid=HcalDetId(RefChanns[i]);
00791     for (int icap=0; icap<4; icap++) {
00792       RefPedVals[icap]=fRefPedestals->getValues(detid)->getValue(icap);
00793       for (int icap2=icap; icap2<4; icap2++) {
00794         RefPedSigs[icap][icap2]=fRefPedestalWidths->getValues(detid)->getSigma(icap,icap2);
00795         if(icap2!=icap)RefPedSigs[icap2][icap]=RefPedSigs[icap][icap2];
00796       }
00797     }
00798 
00799 // read new raw values
00800     if(isinRaw[detid]) {
00801       for (int icap=0; icap<4; icap++) {
00802         RawPedVals[icap]=fRawPedestals->getValues(detid)->getValue(icap);
00803         for (int icap2=icap; icap2<4; icap2++) {
00804           RawPedSigs[icap][icap2]=fRawPedestalWidths->getValues(detid)->getSigma(icap,icap2);
00805           if(icap2!=icap)RawPedSigs[icap2][icap]=RawPedSigs[icap][icap2];
00806         }
00807       }
00808 
00809 // first quick check if raw values make sense: if not, the channel is treated like absent
00810       for (int icap=0; icap<4; icap++) {
00811         if(RawPedVals[icap]<1. || RawPedSigs[icap][icap]<0.01) isinRaw[detid]=false;
00812         for (int icap2=icap; icap2<4; icap2++){
00813           if(fabs(RawPedSigs[icap][icap2]/sqrt(RawPedSigs[icap][icap]*RawPedSigs[icap2][icap2]))>1.) isinRaw[detid]=false;
00814         }
00815       }
00816     }
00817 
00818 // check raw values against reference
00819     if(isinRaw[detid]) {
00820       for (int icap=0; icap<4; icap++) {
00821         int icap2=(icap+1)%4;
00822         float width=sqrt(RawPedSigs[icap][icap]);
00823         float erof1=width/sqrt((float)nstat[icap]);
00824         float erof2=sqrt(erof1*erof1+RawPedSigs[icap][icap]/(float)nstat[icap]);
00825         float erofwidth=width/sqrt(2.*nstat[icap]);
00826         float diffof1=RawPedVals[icap]-RefPedVals[icap];
00827         float diffof2=RawPedVals[icap]+RawPedVals[icap2]-RefPedVals[icap]-RefPedVals[icap2];
00828         float diffofw=width-sqrt(RefPedSigs[icap][icap]);
00829 
00830 // validation in 2 TS for HB, HE, HO, in 1 TS for HF
00831         int nTS=2;
00832         if(detid.subdet()==HcalForward) nTS=1;
00833         if(nTS==1 && fabs(diffof1)>0.5+erof1) { 
00834           erflag+=1;
00835           PedValLog<<"HcalPedVal: drift in channel "<<detid<<" cap "<<icap<<": "<<RawPedVals[icap]<<" - "<<RefPedVals[icap]<<" = "<<diffof1<<std::endl;
00836         }
00837         if(nTS==2 && fabs(diffof2)>0.5+erof2) { 
00838           erflag+=1;
00839           PedValLog<<"HcalPedVal: drift in channel "<<detid<<" caps "<<icap<<"+"<<icap2<<": "<<RawPedVals[icap]<<"+"<<RawPedVals[icap2]<<" - "<<RefPedVals[icap]<<"+"<<RefPedVals[icap2]<<" = "<<diffof2<<std::endl;
00840         }
00841         if(fabs(diffofw)>0.15*width+erofwidth) {
00842           erflag+=1;
00843           PedValLog<<"HcalPedVal: width changed in channel "<<detid<<" cap "<<icap<<": "<<width<<" - "<<sqrt(RefPedSigs[icap][icap])<<" = "<<diffofw<<std::endl;
00844         }
00845       }
00846     }
00847 
00848 // for disconnected/bad channels restore reference values
00849     else {
00850       PedValLog<<"HcalPedVal: no valid data from channel "<<detid<<std::endl;
00851       erflag+=100000;
00852       HcalPedestal item(detid,RefPedVals[0],RefPedVals[1],RefPedVals[2],RefPedVals[3]);
00853       fValPedestals->addValues(item);
00854       HcalPedestalWidth widthsp(detid);
00855       for (int icap=0; icap<4; icap++) {
00856         for (int icap2=icap; icap2<4; icap2++) widthsp.setSigma(icap2,icap,RefPedSigs[icap2][icap]);
00857       }
00858       fValPedestalWidths->addValues(widthsp);
00859     }
00860 
00861 // end of channel loop
00862   }
00863 
00864   if(erflag==0) PedValLog<<"HcalPedVal: all pedestals checked OK"<<std::endl;
00865 
00866 // now construct the remaining part of the validated objects
00867 // if nothing changed outside tolerance, validated set = reference set
00868   if(erflag%100000 == 0) {
00869     for (int i=0; i<(int)RefChanns.size(); i++){
00870       detid=HcalDetId(RefChanns[i]);
00871       if (isinRaw[detid]) {
00872         HcalPedestalWidth widthsp(detid);
00873         for (int icap=0; icap<4; icap++) {
00874           RefPedVals[icap]=fRefPedestals->getValues(detid)->getValue(icap);
00875           for (int icap2=icap; icap2<4; icap2++) {
00876             RefPedSigs[icap][icap2]=fRefPedestalWidths->getValues(detid)->getSigma(icap,icap2);
00877             if(icap2!=icap)RefPedSigs[icap2][icap]=RefPedSigs[icap][icap2];
00878             widthsp.setSigma(icap2,icap,RefPedSigs[icap2][icap]);
00879           }
00880         }
00881         fValPedestalWidths->addValues(widthsp);
00882         HcalPedestal item(detid,RefPedVals[0],RefPedVals[1],RefPedVals[2],RefPedVals[3]);
00883         fValPedestals->addValues(item);
00884       }
00885     }
00886   }
00887 
00888 // if anything changed, validated set = raw set + reference for missing/bad channels
00889   else {
00890     for (int i=0; i<(int)RawChanns.size(); i++){
00891       detid=HcalDetId(RawChanns[i]);
00892       if (isinRaw[detid]) {
00893         HcalPedestalWidth widthsp(detid);
00894         for (int icap=0; icap<4; icap++) {
00895           RawPedVals[icap]=fRawPedestals->getValues(detid)->getValue(icap);
00896           for (int icap2=icap; icap2<4; icap2++) {
00897             RawPedSigs[icap][icap2]=fRawPedestalWidths->getValues(detid)->getSigma(icap,icap2);
00898             if(icap2!=icap)RawPedSigs[icap2][icap]=RawPedSigs[icap][icap2];
00899             widthsp.setSigma(icap2,icap,RawPedSigs[icap2][icap]);
00900           }
00901         }
00902         fValPedestalWidths->addValues(widthsp);
00903         HcalPedestal item(detid,RawPedVals[0],RawPedVals[1],RawPedVals[2],RawPedVals[3]);
00904         fValPedestals->addValues(item);
00905       }
00906     }
00907   }
00908   return erflag;
00909 }

void HcalPedestalAnalysis::per2CapsHists ( int  flag,
int  id,
const HcalDetId  detid,
const HcalQIESample qie1,
const HcalQIESample qie2,
std::map< HcalDetId, std::map< int, PEDBUNCH > > &  toolT,
const HcalDbService cond 
) [private]

Referenced by processEvent().

void HcalPedestalAnalysis::processEvent ( const HBHEDigiCollection hbhe,
const HODigiCollection ho,
const HFDigiCollection hf,
const HcalDbService cond 
)

Definition at line 120 of file HcalPedestalAnalysis.cc.

References AllChanHists(), edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), evt, evt_curr, HcalDbService::getHcalCoder(), HcalDbService::getHcalShape(), hbHists, hfHists, hoHists, i, HODataFrame::id(), HBHEDataFrame::id(), HFDataFrame::id(), int, j, k, m_coder, m_endTS, m_nevtsample, m_shape, m_startTS, per2CapsHists(), HFDataFrame::sample(), HBHEDataFrame::sample(), sample, HODataFrame::sample(), SampleAnalysis(), HODataFrame::size(), HBHEDataFrame::size(), edm::SortedCollection< T, SORT >::size(), HFDataFrame::size(), and state.

Referenced by HcalPedestalAnalyzer::analyze().

00124 {
00125   evt++;
00126   sample=1;
00127   evt_curr=evt;
00128   if(m_nevtsample>0) {
00129     sample = (evt-1)/m_nevtsample +1;
00130     evt_curr = evt%m_nevtsample;
00131     if(evt_curr==0)evt_curr=m_nevtsample;
00132   }
00133 
00134   m_shape = cond.getHcalShape();
00135   // Get data for every CAPID.
00136   // HBHE
00137   try{
00138     if(!hbhe.size()) throw (int)hbhe.size();
00139     for (HBHEDigiCollection::const_iterator j=hbhe.begin(); j!=hbhe.end(); j++){
00140       const HBHEDataFrame digi = (const HBHEDataFrame)(*j);
00141       m_coder = cond.getHcalCoder(digi.id());
00142       for(int k=0; k<(int)state.size();k++) state[k]=true;
00143 // here we loop over pairs of time slices, it is more convenient
00144 // in order to extract the correlation matrix
00145       for (int i=m_startTS; i<digi.size() && i<=m_endTS; i++) {
00146         for(int flag=0; flag<4; flag++){
00147           if(i+flag<digi.size() && i+flag<=m_endTS){
00148             per2CapsHists(flag,0,digi.id(),digi.sample(i),digi.sample(i+flag),hbHists.PEDTRENDS,cond);
00149           }
00150         }
00151       }
00152       if(m_startTS==0 && m_endTS>4){
00153         AllChanHists(digi.id(),digi.sample(0),digi.sample(1),digi.sample(2),digi.sample(3),digi.sample(4),digi.sample(5),hbHists.PEDTRENDS);
00154       }
00155     }
00156   }
00157   catch (int i ) {
00158 //    m_logFile<< "Event with " << i<<" HBHE Digis passed." << std::endl;
00159   } 
00160   // HO
00161   try{
00162     if(!ho.size()) throw (int)ho.size();
00163     for (HODigiCollection::const_iterator j=ho.begin(); j!=ho.end(); j++){
00164       const HODataFrame digi = (const HODataFrame)(*j);
00165       m_coder = cond.getHcalCoder(digi.id());
00166       for (int i=m_startTS; i<digi.size() && i<=m_endTS; i++) {    
00167         for(int flag=0; flag<4; flag++){
00168           if(i+flag<digi.size() && i+flag<=m_endTS){
00169             per2CapsHists(flag,1,digi.id(),digi.sample(i),digi.sample(i+flag),hoHists.PEDTRENDS,cond);
00170           }
00171         }
00172       }
00173       if(m_startTS==0 && m_endTS>4){
00174         AllChanHists(digi.id(),digi.sample(0),digi.sample(1),digi.sample(2),digi.sample(3),digi.sample(4),digi.sample(5),hoHists.PEDTRENDS);
00175       }
00176     }        
00177   } 
00178   catch (int i ) {
00179 //    m_logFile << "Event with " << i<<" HO Digis passed." << std::endl;
00180   } 
00181   // HF
00182   try{
00183     if(!hf.size()) throw (int)hf.size();
00184     for (HFDigiCollection::const_iterator j=hf.begin(); j!=hf.end(); j++){
00185       const HFDataFrame digi = (const HFDataFrame)(*j);
00186       m_coder = cond.getHcalCoder(digi.id());
00187       for (int i=m_startTS; i<digi.size() && i<=m_endTS; i++) {
00188         for(int flag=0; flag<4; flag++){
00189           if(i+flag<digi.size() && i+flag<=m_endTS){
00190             per2CapsHists(flag,2,digi.id(),digi.sample(i),digi.sample(i+flag),hfHists.PEDTRENDS,cond);
00191           }
00192         }
00193       }
00194       if(m_startTS==0 && m_endTS>4){
00195         AllChanHists(digi.id(),digi.sample(0),digi.sample(1),digi.sample(2),digi.sample(3),digi.sample(4),digi.sample(5),hfHists.PEDTRENDS);
00196       }
00197     }
00198   } 
00199   catch (int i ) {
00200 //    m_logFile << "Event with " << i<<" HF Digis passed." << std::endl;
00201   } 
00202   // Call the function every m_nevtsample events
00203   if(m_nevtsample>0) {
00204     if(evt%m_nevtsample==0) SampleAnalysis();
00205   }
00206 }

void HcalPedestalAnalysis::SampleAnalysis (  ) 

Definition at line 326 of file HcalPedestalAnalysis.cc.

References GetPedConst(), hbHists, hfHists, hoHists, m_file, and sample.

Referenced by done(), and processEvent().

00326                                          {
00327   // it is called every m_nevtsample events (a sample) and the end of run
00328   char PedSampleNum[20];
00329 
00330 // Compute pedestal constants for each HBHE, HO, HF
00331   sprintf(PedSampleNum,"HB_Sample%d",sample);
00332   m_file->cd();
00333   m_file->mkdir(PedSampleNum);
00334   m_file->cd(PedSampleNum);
00335   GetPedConst(hbHists.PEDTRENDS,hbHists.PEDMEAN,hbHists.PEDRMS);
00336   sprintf(PedSampleNum,"HO_Sample%d",sample);
00337   m_file->cd();
00338   m_file->mkdir(PedSampleNum);
00339   m_file->cd(PedSampleNum);
00340   GetPedConst(hoHists.PEDTRENDS,hoHists.PEDMEAN,hoHists.PEDRMS);
00341   sprintf(PedSampleNum,"HF_Sample%d",sample);
00342   m_file->cd();
00343   m_file->mkdir(PedSampleNum);
00344   m_file->cd(PedSampleNum);
00345   GetPedConst(hfHists.PEDTRENDS,hfHists.PEDMEAN,hfHists.PEDRMS);
00346 }

void HcalPedestalAnalysis::setup ( const std::string &  m_outputFileROOT  ) 

Definition at line 108 of file HcalPedestalAnalysis.cc.

References m_file.

Referenced by HcalPedestalAnalyzer::HcalPedestalAnalyzer().

00108                                                                   {
00109   // open the histogram file, create directories within
00110   m_file=new TFile(m_outputFileROOT.c_str(),"RECREATE");
00111   m_file->mkdir("HB");
00112   m_file->cd();
00113   m_file->mkdir("HO");
00114   m_file->cd();
00115   m_file->mkdir("HF");
00116   m_file->cd();
00117 }

void HcalPedestalAnalysis::Trendings ( std::map< HcalDetId, std::map< int, PEDBUNCH > > &  toolT,
TH1F *  Chi2,
TH1F *  CapidAverage,
TH1F *  CapidChi2 
) [private]

Referenced by done().


Member Data Documentation

std::map<HcalDetId,std::map<int, PEDBUNCH > >::iterator HcalPedestalAnalysis::_meot [private]

Definition at line 124 of file HcalPedestalAnalysis.h.

Referenced by ~HcalPedestalAnalysis().

TH1F* HcalPedestalAnalysis::ALLPEDS

Definition at line 117 of file HcalPedestalAnalysis.h.

TH1F* HcalPedestalAnalysis::CAPID_AVERAGE

Definition at line 121 of file HcalPedestalAnalysis.h.

TH1F* HcalPedestalAnalysis::CAPID_CHI2

Definition at line 122 of file HcalPedestalAnalysis.h.

TH1F* HcalPedestalAnalysis::CHI2

Definition at line 120 of file HcalPedestalAnalysis.h.

int HcalPedestalAnalysis::evt [private]

Definition at line 131 of file HcalPedestalAnalysis.h.

Referenced by done(), HcalPedestalAnalysis(), and processEvent().

int HcalPedestalAnalysis::evt_curr [private]

Definition at line 133 of file HcalPedestalAnalysis.h.

Referenced by processEvent().

const int HcalPedestalAnalysis::fitflag = 0 [static, private]

Definition at line 138 of file HcalPedestalAnalysis.h.

HcalPedestals* HcalPedestalAnalysis::fRawPedestals [private]

Definition at line 127 of file HcalPedestalAnalysis.h.

Referenced by done().

HcalPedestalWidths* HcalPedestalAnalysis::fRawPedestalWidths [private]

Definition at line 128 of file HcalPedestalAnalysis.h.

Referenced by done().

const HcalPedestals* HcalPedestalAnalysis::fRefPedestals [private]

Definition at line 125 of file HcalPedestalAnalysis.h.

Referenced by done().

const HcalPedestalWidths* HcalPedestalAnalysis::fRefPedestalWidths [private]

Definition at line 126 of file HcalPedestalAnalysis.h.

Referenced by done().

HcalPedestals* HcalPedestalAnalysis::fValPedestals [private]

Definition at line 129 of file HcalPedestalAnalysis.h.

Referenced by done().

HcalPedestalWidths* HcalPedestalAnalysis::fValPedestalWidths [private]

Definition at line 130 of file HcalPedestalAnalysis.h.

Referenced by done().

struct { ... } HcalPedestalAnalysis::hbHists [private]

Referenced by done(), HcalPedestalAnalysis(), processEvent(), SampleAnalysis(), and ~HcalPedestalAnalysis().

struct { ... } HcalPedestalAnalysis::hfHists [private]

Referenced by done(), HcalPedestalAnalysis(), processEvent(), SampleAnalysis(), and ~HcalPedestalAnalysis().

struct { ... } HcalPedestalAnalysis::hoHists [private]

Referenced by done(), HcalPedestalAnalysis(), processEvent(), SampleAnalysis(), and ~HcalPedestalAnalysis().

int HcalPedestalAnalysis::m_AllPedsOK [private]

Definition at line 111 of file HcalPedestalAnalysis.h.

Referenced by done(), and HcalPedestalAnalysis().

const HcalQIECoder* HcalPedestalAnalysis::m_coder [private]

Definition at line 114 of file HcalPedestalAnalysis.h.

Referenced by processEvent().

int HcalPedestalAnalysis::m_endTS [private]

Definition at line 106 of file HcalPedestalAnalysis.h.

Referenced by HcalPedestalAnalysis(), and processEvent().

TFile* HcalPedestalAnalysis::m_file [private]

Definition at line 99 of file HcalPedestalAnalysis.h.

Referenced by done(), HcalPedestalAnalysis(), SampleAnalysis(), and setup().

int HcalPedestalAnalysis::m_hiSaveflag [private]

Definition at line 109 of file HcalPedestalAnalysis.h.

Referenced by HcalPedestalAnalysis().

std::ofstream HcalPedestalAnalysis::m_logFile [private]

Definition at line 104 of file HcalPedestalAnalysis.h.

int HcalPedestalAnalysis::m_nevtsample [private]

Definition at line 107 of file HcalPedestalAnalysis.h.

Referenced by done(), HcalPedestalAnalysis(), and processEvent().

std::string HcalPedestalAnalysis::m_outputFileMean [private]

Definition at line 102 of file HcalPedestalAnalysis.h.

Referenced by HcalPedestalAnalysis().

std::string HcalPedestalAnalysis::m_outputFileROOT [private]

Definition at line 101 of file HcalPedestalAnalysis.h.

Referenced by done(), and HcalPedestalAnalysis().

std::string HcalPedestalAnalysis::m_outputFileWidth [private]

Definition at line 103 of file HcalPedestalAnalysis.h.

Referenced by HcalPedestalAnalysis().

int HcalPedestalAnalysis::m_pedsinADC [private]

Definition at line 108 of file HcalPedestalAnalysis.h.

Referenced by HcalPedestalAnalysis().

int HcalPedestalAnalysis::m_pedValflag [private]

Definition at line 110 of file HcalPedestalAnalysis.h.

Referenced by done(), and HcalPedestalAnalysis().

const HcalQIEShape* HcalPedestalAnalysis::m_shape [private]

Definition at line 113 of file HcalPedestalAnalysis.h.

Referenced by processEvent().

int HcalPedestalAnalysis::m_startTS [private]

Definition at line 105 of file HcalPedestalAnalysis.h.

Referenced by HcalPedestalAnalysis(), and processEvent().

float HcalPedestalAnalysis::m_stat[4] [private]

Definition at line 134 of file HcalPedestalAnalysis.h.

Referenced by done(), and HcalPedestalAnalysis().

TH1F* HcalPedestalAnalysis::PEDMEAN

Definition at line 119 of file HcalPedestalAnalysis.h.

TH1F* HcalPedestalAnalysis::PEDRMS

Definition at line 118 of file HcalPedestalAnalysis.h.

std::map<HcalDetId,std::map<int, PEDBUNCH > > HcalPedestalAnalysis::PEDTRENDS

Definition at line 116 of file HcalPedestalAnalysis.h.

int HcalPedestalAnalysis::sample [private]

Definition at line 132 of file HcalPedestalAnalysis.h.

Referenced by HcalPedestalAnalysis(), processEvent(), and SampleAnalysis().

std::vector<bool> HcalPedestalAnalysis::state [private]

Definition at line 135 of file HcalPedestalAnalysis.h.

Referenced by HcalPedestalAnalysis(), and processEvent().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:23:48 2009 for CMSSW by  doxygen 1.5.4