CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

HcalSiPMShape Class Reference

#include <HcalSiPMShape.h>

Inheritance diagram for HcalSiPMShape:
CaloVShape

List of all members.

Public Member Functions

 HcalSiPMShape ()
 HcalSiPMShape (const HcalSiPMShape &other)
virtual double operator() (double time) const
virtual double timeToRise () const
virtual ~HcalSiPMShape ()

Protected Member Functions

void computeShape ()

Private Attributes

int nBins_
std::vector< double > nt_

Detailed Description

Definition at line 8 of file HcalSiPMShape.h.


Constructor & Destructor Documentation

HcalSiPMShape::HcalSiPMShape ( )

Definition at line 5 of file HcalSiPMShape.cc.

References computeShape().

                             : CaloVShape(), nBins_(512), nt_(nBins_, 0.) {
  computeShape();
}
HcalSiPMShape::HcalSiPMShape ( const HcalSiPMShape other)

Definition at line 9 of file HcalSiPMShape.cc.

                                                        :
  CaloVShape(other), nBins_(other.nBins_), nt_(other.nt_) {
}
virtual HcalSiPMShape::~HcalSiPMShape ( ) [inline, virtual]

Definition at line 14 of file HcalSiPMShape.h.

{}

Member Function Documentation

void HcalSiPMShape::computeShape ( ) [protected]

Definition at line 236 of file TShapeAnalysis.cc.

References alpha, beta, debug, TFParams::fitpj(), i, getHLTprescales::index, gen::k, TFParams::set_const(), and tablePrinter::width.

Referenced by HcalSiPMShape().

{

  double tm_atmax[200];
  double parout[3];

  double chi2_all=0.;

  double **dbi ;
  dbi = new double *[200];
  for(int k=0;k<200;k++) dbi[k] = new double[2];

  double **signalu ;
  signalu = new double *[200];
  for(int k=0 ;k<200;k++) signalu[k] = new double[10];        

  TFParams *pjf = new TFParams() ;

  for(int i=0;i<nchsel;i++) {

    if(index[i] >= 0) {
      
      if(npass[i] <= 10) {

        putalphaVal(i, alpha_init[i]);
        putbetaVal(i, beta_init[i]);
        putwidthVal(i,width_init[i]);
        putchi2Val(i,chi2_init[i]);
        putflagVal(i,0);
        
      } else {
        
        pjf->set_const(nsamplecristal, sampbmax, sampamax, alpha_init[i], beta_init[i], npass[i]);
        
        for(int pass=0;pass<npass[i];pass++){
          
          double ped=0;
          for(int k=0;k<presample;k++) {
            ped+= rawsglu[i][pass][k];
          }
          ped/=double(presample);
          
          for(int k=0;k<nsamplecristal;k++) {
            signalu[pass][k]= rawsglu[i][pass][k]-ped;
          }
        }
        
        int debug=0;
        chi2_all= pjf->fitpj(signalu,&parout[0],dbi,noise, debug);
        
        if(parout[0]>=0.0 && parout[1]>=0.0 && chi2_all<=chi2cut && chi2_all>0.0){
          
          putalphaVal(i,parout[0]);
          putbetaVal(i,parout[1]);
          putchi2Val(i,chi2_all);
          putflagVal(i,1);
          
        }else{
          
          putalphaVal(i,alpha_init[i]);
          putbetaVal(i,beta_init[i]);
          putwidthVal(i,width_init[i]);
          putchi2Val(i,chi2_init[i]);
          putflagVal(i,0);
          
        } 
        
        for(int kj=0;kj<npass[i];kj++) { // last event wrong here
          tm_atmax[kj]= dbi[kj][1];
        }
        computetmaxVal(i,&tm_atmax[0]);
        
      }
    }
  }
  
  if(tAB) tABinit=tAB->CloneTree();
  
  // Declaration of leaf types
  Int_t           sidei;
  Int_t           iphii;
  Int_t           ietai;
  Int_t           dccIDi;
  Int_t           towerIDi;
  Int_t           channelIDi;
  Double_t        alphai;
  Double_t        betai;
  Double_t        widthi;
  Double_t        chi2i;
  Int_t           flagi;
  
  // List of branches
  TBranch        *b_iphi;   
  TBranch        *b_ieta;   
  TBranch        *b_side;   
  TBranch        *b_dccID;   
  TBranch        *b_towerID;   
  TBranch        *b_channelID;   
  TBranch        *b_alpha;   
  TBranch        *b_beta;   
  TBranch        *b_width;   
  TBranch        *b_chi2;   
  TBranch        *b_flag;   
  

  if(tABinit){
    tABinit->SetBranchAddress("iphi", &iphii, &b_iphi);
    tABinit->SetBranchAddress("ieta", &ietai, &b_ieta);
    tABinit->SetBranchAddress("side", &sidei, &b_side);
    tABinit->SetBranchAddress("dccID", &dccIDi, &b_dccID);
    tABinit->SetBranchAddress("towerID", &towerIDi, &b_towerID);
    tABinit->SetBranchAddress("channelID", &channelIDi, &b_channelID);
    tABinit->SetBranchAddress("alpha", &alphai, &b_alpha);
    tABinit->SetBranchAddress("beta", &betai, &b_beta);
    tABinit->SetBranchAddress("width", &widthi, &b_width);
    tABinit->SetBranchAddress("chi2", &chi2i, &b_chi2);
    tABinit->SetBranchAddress("flag", &flagi, &b_flag);
  }

  TFile *fABout = new TFile(namefile.c_str(), "RECREATE");
  tABout=new TTree("ABCol0","ABCol0");
  
  // Declaration of leaf types
  Int_t           side;
  Int_t           iphi;
  Int_t           ieta;
  Int_t           dccID;
  Int_t           towerID;
  Int_t           channelID;
  Double_t        alpha;
  Double_t        beta;
  Double_t        width;
  Double_t        chi2;
  Int_t           flag;
  
  tABout->Branch( "iphi",      &iphi,       "iphi/I"      );
  tABout->Branch( "ieta",      &ieta,       "ieta/I"      );
  tABout->Branch( "side",      &side,       "side/I"      );
  tABout->Branch( "dccID",     &dccID,      "dccID/I"     );
  tABout->Branch( "towerID",   &towerID,    "towerID/I"   );
  tABout->Branch( "channelID", &channelID,  "channelID/I" );
  tABout->Branch( "alpha",     &alpha,     "alpha/D"    );
  tABout->Branch( "beta",      &beta,      "beta/D"     );
  tABout->Branch( "width",     &width,     "width/D"    );
  tABout->Branch( "chi2",      &chi2,      "chi2/D"     );
  tABout->Branch( "flag",      &flag,      "flag/I"     );
  
  tABout->SetBranchAddress( "ieta",      &ieta       );  
  tABout->SetBranchAddress( "iphi",      &iphi       ); 
  tABout->SetBranchAddress( "side",      &side       );
  tABout->SetBranchAddress( "dccID",     &dccID      );
  tABout->SetBranchAddress( "towerID",   &towerID    );
  tABout->SetBranchAddress( "channelID", &channelID  );
  tABout->SetBranchAddress( "alpha",     &alpha     );
  tABout->SetBranchAddress( "beta",      &beta      );
  tABout->SetBranchAddress( "width",     &width     );
  tABout->SetBranchAddress( "chi2",      &chi2      );
  tABout->SetBranchAddress( "flag",      &flag      );
  
  for(int i=0;i<nchsel;i++) {
    
    if(tABinit){
      
      tABinit->GetEntry(i);
      iphi=iphii;
      ieta=ietai;
      side=sidei;
      dccID=dccIDi;
      towerID=towerIDi;
      channelID=channelIDi;
   
    }else{
      
      iphi=phi_init[i];
      ieta=eta_init[i];
      side=side_init[i];
      dccID=dcc_init[i];
      towerID=tower_init[i];
      channelID=ch_init[i];
      
    }
    
    alpha=alpha_val[i];
    beta=beta_val[i];
    width=width_val[i];
    chi2=chi2_val[i];
    flag=flag_val[i];
    
    tABout->Fill();
  }
  
  
  tABout->Write();
  fABout->Close();

  delete pjf;
}
double HcalSiPMShape::operator() ( double  time) const [virtual]

Implements CaloVShape.

Definition at line 13 of file HcalSiPMShape.cc.

References nBins_, and nt_.

                                                    {
  int jtime = static_cast<int>(time + 0.5);
  if (jtime>=0 && jtime<nBins_) 
    return nt_[jtime];
  return 0.;
}
virtual double HcalSiPMShape::timeToRise ( ) const [inline, virtual]

Implements CaloVShape.

Definition at line 18 of file HcalSiPMShape.h.

{return 33.;}

Member Data Documentation

int HcalSiPMShape::nBins_ [private]

Definition at line 24 of file HcalSiPMShape.h.

Referenced by operator()().

std::vector<double> HcalSiPMShape::nt_ [private]

Definition at line 25 of file HcalSiPMShape.h.

Referenced by operator()().