// 8-sep-04
#include "TString.h"

class TList;
class TH1F;
class TH2F;
class TF1;
class TH1;
class TH2;
class TCanvas;
class AliEMCALGeometry;
class AliEMCALHit;
class TMap;
class TParticle;
class TGraph;
class AliEMCAL;

void rHits(int nmax=1000, int var=61,const char* opt="",const char* fntmp="");
void drDeVsPoints(int mode=61, int phiOrDe=0); // 0-phi, 1 de for 101<=mode<=103
void getMeanAndRmsDe(int VAR, int shift, const char* opt, double &mean,double &emean, double &rms, double &erms);
void defineSampleFraction(int var=0, const char* opt="digi");
void sumOfResolution(); // Feb 14,2006
// For hits - 29-mar-05
TList *bookHitsHists(AliEMCALGeometry* g=0);
TList *bookKineHists();
Int_t  fillHitsHists(AliEMCALHit *hit, Int_t ih);
void   fillIndexHists(int absId);
Int_t  fillKineHists();

// jet
Int_t  anaTrigPythiaJet(double de); 
TList *defineJetHists(int key=1); 
void drDeVsJetsPhi(int mode);
// gamma additional - 04-04-05
//void anaGamma();
TList *defineGammaHists();

void defineInputDirectory(int VAR=0, const char* opt="", const char* fntmp="");
void getGeometry(const char* inpFile="galice.root"); // 

void  saveHists1(const char* name="10GeV.root");
void  readHists1(const char* name="test10GeV.root");
// 10-dec-04 
void  saveHists2(int var=71, const char* opt="digi"); 
TList *readHists2(int var, const char* opt, bool putToBrowser);
// --
TH1F* readHist(int var=71);
TH1F* readHistOct05(int var=121, TString OPT="");
TMap* getFileMap(const char* fn="fileListOct05.dat", const char *dir="$HOME/ALICE/SHISHKEBAB/");
TString getFileName(int var);

// Create SDIGITs and digits - 17-nov-04
void crSdg(int nmax=-1, int var=71,const char* execOpt="deb pri");
void  crDgFrSdg(int nmax=-1, int var=71,const char* execOpt="deb pri all");
void crSdgAndDg(int nmax, int var,TString eo);

// Test sdigits
void  sdgt(int nmax=1, int var=71,const char* opt="");
// Test digits
void dgt(int nmax=1, int var=71, TString opt="", double eTh=0.05, double cellSeed=0.4,
int maxCell=9, const char* fntmp="");
// Oct 31, 2006
// dgt(0,0,"",0.016,0.15,16,"");// for 1 gev/c
// 
int drawLegoSM(TCanvas *c,TH2F* hlego, int nev);
// dgt(1000, 77, "2X2", 0.05, "digiMixedWithHijingCent1.root"); // 26-jan-05
void readDgt(int nmax=100, int var=71,const char* opt="", int mode=0);
/// Mixing of sDigits
void  dgMix(int nmax=1, int var=71, int varMix=201);
void  dgMixTest(int nmax=1);
TList* bookHistsForDigits(int var, double eTh, double cellSeed, int maxCell, char *tmpn); 
// Picture for hadron suppression - 12-nov-05
void hs(int ve, int vh, TString opt);
void hs(int ve, TString opt) {hs(ve,ve+10, opt);} // for lazy people
TList* readHistForHS(int var=101);
void drawEoverP(TH1F *h1, TH1F *h2);
void drawHSvsEf(TH1F *h1,TH1F *h2, TH1F *hn1,TH1F *hn2);
// DRAW pictures
void  ocuSum();
TH1F* dOcu(int var, const char* opt);
void  gammaResponseTrd1VsTrd2(int key=2, char* geom="EMCAL");// 30-mar-05
TH1  *gammaPhiUniformityTRD12(char* geom="EMCAL", int var=72, TH1 *htmp=0);
void  gammaUniform(int varTD2=72, int varTRD1=110);
void  jetResponseTrd1VsTrd2(int key=2,char* geom="EMCAL", int stat=11); 
// 31-mar-05
void  jetResponseUniformityTrd1VsTrd2(char* geom="EMCAL", int stat=10, int divKey=0);
void  getJetsFiles(int stat, TString GEOM, TString& TIT, char *ftrd[2]);
// 19-sep-05 - picture for Geant's cuts
void  deForDiffCuts(TString opt="new", TString nid="hNhits");
// nid : "hDE" ; "hNhits"
// 
// May 15, 2006; thickness of stainless steel skin
TList   *bookSSSHists();
void     fillSSSHists(TList *l, double de, double deMaxTower, int indMaxTower);
TCanvas *pict1SSS(int nfile=121);
const char *getTitSSS(int nfile=121);
// Summary pictures
void pictSumAllSSS(int ind=7);
TGraph *pictSum1_SSS(TString opt="2mm", int indHist=7, char* drawOpt="AC");
void getMeanAndRmsSSS(int nfile, int indHist, double &mean, double &rms);
// test geometry
void trd1();
void drawIndexes(TList *l=0);
// some examples - Mar 9,2007
AliEMCAL* getEMCAL(const char* name="galice.root");

void legoEMCAL(
const char *setup="../ConfigPPR.C", 
Int_t ntheta=50,   Float_t thetamin=53.0,  Float_t thetamax=90.,
Int_t nphi=50, Float_t phimin=120., Float_t phimax=180., 
Float_t rmin=200.,  Float_t rmax=470.,   Float_t zmax=10000.);

void  materialNoEmcal(int var=1, int write=0);
void  materialPhiProfile(int var=3);
TH1** getPhiDist(TH2 *hid=0);

void   drawLegoEMCAL(int var=0);
TList *getHistograms(int var=0);
void   saveLegoHists(const char *fname=" ETA035/mod13.root"); 
void priSmall(TH2F *hid=0, double valMin=2., int draw=0); 
// Gaus with Integral - 7-apr-05 
TF1* gausi(const char *addName="i", double xmi=0.0, double xma=1., 
double p0=1., double p1=1., double p2=1., double width=0.1);
Double_t gi(Double_t *x, Double_t *par); 
// Feb 16, 2006
bool initAlice(const char *fname="galice.root");
// Mar 21, 2006
void runRadLengthVsRho();
/*
  .x rHits.C(0, 102, "2X2"); // 101,102,103 and 106,107,108
// -- 101, 102, 103
   drDeVsPoints(101,1); // eta crack with aver. on phi 
   drDeVsPoints(101,0); // phi crack with aver. on eta
// -- 106, 107, 108
   drDeVsPoints(106); // eta crack with fix phi 
// --
   drDeVsPoints(61);
// -- May 2005
   drDeVsPoints(400);
// Have to run in directory with Geant output; May 15, 2006
   .L $HOME/ALICE/SHISHKEBAB/rHits.C+
   rHits(0, 0, "2X2")

// May 22, 2006; pictures for Tom 
  pictSum1_SSS("2mm", 7, "AC"); // 

  pictSumAllSSS(7);

// Jun 01, 2006; test new numbering scheme 
  pict1SSS(141); 

 */

/*
  TO DO
--
  DONE
1. Energy resolution vs energy of gamma and SF - 19-oct-04; 18-nov
2. SDIGITS - 17-nov-04; 23-nov-04
3. DIGITS  - 23-nov-04; 24-nov-04
4. TRD2 geometry - 27-jan-05; 7-feb-05
=======================================================
 INFO
1. AliEMCALSDigitizer::Exec - loop over all events or just one !!
*/
/*
  Create picture(s) - 9-sep-05
1. jetResponseUniformityTrd1VsTrd2("COMPLETE", 12, 0)

2. Current simulations: 
/auto/pdsfdv68/alice/pavlinov/PROD/GAMMA/SHISH_62_TRD1/PYTHIA/JETSEP05/FULLALICE

3. Cuts
  10 kev; 2000 events
Real time 1:32:35, CP time 5544.890
  50 kev;  2000 event
Real time 0:43:20, CP time 2592.680

*/