2   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
   10 // utility for Pixel Offline Claibration Classes
 
   11 inline double *LogaritmicBins(int NTOT, double START, double END){
 
   12     double *bins = new double[NTOT+1];
 
   13     for(int i = 0 ; i < NTOT + 1 ; i++) 
 
   14         bins[i] = START * pow( END/START, double(i)/double(NTOT) );
 
   19 inline double *IntegerBins(int NTOT, double NSTART = 0, double PASS = 1){
 
   20     double *bins = new double[NTOT+1];
 
   21     for(int i = 0; i < NTOT + 1; i++) bins[i] = NSTART + PASS * i;
 
   25 inline int EtaModuleBins(double *&bins){
 
   26     bins = IntegerBins(13,-6);
 
   30 inline int DiskEtaModuleBins(double *&bins){
 
   31     bins = IntegerBins(2,-1);
 
   35 inline int BlayerPhiModuleBins(double *&bins){
 
   36     bins = IntegerBins(22);
 
   40 inline int Layer1PhiModuleBins(double *&bins){
 
   41     bins = IntegerBins(36);
 
   45 inline int Layer2PhiModuleBins(double *&bins){
 
   46     bins = IntegerBins(52);
 
   50 inline int DiskPhiModuleBins(double *&bins){
 
   51     bins = IntegerBins(48);
 
   55 inline std::vector<float> *getLayersBins(){
 
   57     std::vector<float> *layers = new std::vector<float>();
 
   58     for(int i =0 ; i < 8; i++ ) layers->push_back(float(i));
 
   63 inline void RecursiveFit(TH1 *swap, TF1 *f1, int parameter){        
 
   68         const char* f1name = f1->GetName();
 
   69         swap->Fit(f1name,"RQ0");
 
   70         while(fabs(newrms - oldrms) > oldrms*0.01 ){
 
   71             if( nfits++ > 100 ) break;
 
   72             oldrms = f1->GetParameter(parameter);
 
   73             mean = f1->GetParameter(1);
 
   74             f1->SetRange(mean-1.5*oldrms,mean+1.5*oldrms);
 
   75             swap->Fit("f1","RQ0");
 
   76             newrms = f1->GetParameter(parameter);
 
   77             //std::cout << oldrms << " " << newrms << std::endl;