CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/CalibCalorimetry/CastorCalib/interface/CastorLedAnalysis.h

Go to the documentation of this file.
00001 #ifndef CastorLedAnalysis_H
00002 #define CastorLedAnalysis_H
00003 
00004 
00005 #include "FWCore/Framework/interface/Frameworkfwd.h"
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007 #include "FWCore/Framework/interface/Event.h"
00008 #include "FWCore/Framework/interface/MakerMacros.h"
00009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00010 #include "FWCore/ServiceRegistry/interface/Service.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 
00013 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00014 
00015 
00016 #include "TH1F.h"
00017 #include "TF1.h"
00018 #include "TProfile.h"
00019 
00020 
00021 #include <memory>
00022 //#include <iostream>
00023 #include <fstream>
00024 #include <vector>
00025 #include <string>
00026 
00027 class CastorPedestal;
00028 class CastorDbService;
00029 class CastorQIEShape;
00030 class CastorQIECoder;
00031 class TFile;
00032 
00033 class CastorLedAnalysis{
00034   
00035 public:
00036   
00038   CastorLedAnalysis(const edm::ParameterSet& ps);  
00040   ~CastorLedAnalysis();
00041   void LedSetup(const std::string& m_outputFileROOT);
00042   //void doPeds(const CastorPedestals* fInputPedestals);
00043   void LedSampleAnalysis();
00044   void LedDone();
00045   void processLedEvent(const CastorDigiCollection& castor,
00046                     const CastorDbService& cond);
00047 
00048 protected:
00049   
00050   
00051 private:
00052   //###
00053   //#  LEDBUNCH is used in map<HcalDetId,map<int, LEDBUNCH > > LEDTRENDS;
00054   //#  For each HcalDetId (channel) a map<int, LEDBUNCH> is associated;
00055   //#  int was originally cap-id and now is just dummy;
00056   //#  LEDBUNCH is a pair - first element is the main 
00057   //#  histo with the ADC values and second one is another pair;
00058   //#  this pair contains map<int, std::vector<double> > as a first element;
00059   //#  vector contains some useful variables;
00060   //#  the second element is a vector of histos (pointers);
00061   //#  for the "trend" analysis the main histo (with ADC values) is reset every 
00062   //#  m_nevtsample events and info is put in the other part of the LEDBUNCH;
00063   //#  so at the end we have the trends for the variables in concern
00064   //#  which are written in THE vector<TH1F*>; 
00065   //###  
00066   typedef std::pair<TH1F*,std::pair<std::map<int, std::vector<double> >,std::vector<TH1F*> > > LEDBUNCH;
00067   typedef struct{
00068     TProfile* avePulse[3];
00069     TH1F* thisPulse[3];
00070     TH1F* integPulse[3];
00071   } CALIBBUNCH;
00072   TFile* m_file;
00073   void LedCastorHists(const HcalDetId& detid, const CastorDataFrame& ledDigi, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT, const CastorDbService& cond);
00074   void SetupLEDHists(int id, const HcalDetId detid, std::map<HcalDetId, std::map<int,LEDBUNCH> > &toolT);
00075   void GetLedConst(std::map<HcalDetId,std::map<int, LEDBUNCH > > &toolT);
00076   void LedTrendings(std::map<HcalDetId,std::map<int, LEDBUNCH > > &toolT);
00077   float BinsizeCorr(float time);
00078   
00079   std::string m_outputFileROOT;
00080   std::string m_outputFileText;
00081   std::string m_outputFileX;
00082   std::ofstream m_outFile;
00083   std::ofstream m_logFile;
00084   std::ofstream m_outputFileXML;
00085   char output[100];
00086  
00087   int m_startTS;
00088   int m_endTS;
00089   int m_nevtsample;
00090   int m_hiSaveflag;
00091   bool m_usecalib;
00092 // analysis flag:
00093 //  m_fitflag = 0  - take mean TS value of averaged pulse shape
00094 //              1  - take peak from landau fit to averaged pulse shape
00095 //              2  - take average of mean TS values per event
00096 //                     (preferred for laser & HF LED)
00097 //              3  - take average of peaks from landau fits per event
00098 //                     (preferred for LED)
00099 //              4  - 0+1+2+3 REMOVED in 1_6
00100   int m_fitflag;
00101   
00102   const CastorQIEShape* m_shape;
00103   const CastorQIECoder* m_coder;
00104   const CastorPedestal* m_ped;
00105   struct{
00106     std::map<HcalDetId,std::map<int, LEDBUNCH > > LEDTRENDS;
00107     TH1F* ALLLEDS;
00108     TH1F* LEDRMS;
00109     TH1F* LEDMEAN;
00110     TH1F* CHI2;
00111   } castorHists;
00112   std::map<HcalDetId,std::map<int, LEDBUNCH > >::iterator _meol;
00113   std::map<HcalDetId,std::map<int,float> > m_AllPedVals;
00114   std::map<HcalDetId,std::map<int,float> >::iterator _meee;
00115 
00116   std::map<HcalCalibDetId,CALIBBUNCH>::iterator _meca;
00117 
00118   //const CastorPedestal* pedCan;
00119   int evt;
00120   int sample;
00121   int evt_curr;
00122   std::vector<bool> state;
00123 
00124 };
00125 
00126 #endif