Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/DispSkymap.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/DispSkymap.C	(revision 6486)
+++ 	(revision )
@@ -1,223 +1,0 @@
-//************************************************************************
-//
-// Authors : Eva Domingo,     1/2005 <mailto:domingo@ifae.es>
-//
-//
-// Macro for generating DISP Skymap of the FoV
-// -------------------------------------------
-//
-//************************************************************************
-
-void DispSkymap(TString onfilename  = "ONhillasfile.root",
-		TString offfilename = "OFFhillasfile.root",
-		TString outfilename = "skymaps.root",
-		Float_t HadronnessCut = 0.06, 
-		Float_t SizeCut = 1000.)
-{
-  //======================================================================
-  // Make Disp plots
-  //======================================================================
-  
-  gLog << "-----------------------------------------------------" << endl; 
-  gLog << "Make Disp related plots" << endl;
-  gLog << "-----------------------------------------------------" << endl; 
-  
-  // Input root file/s storing the computed Hillas and Disp parameters
-  gLog << "Input ON file/s: "  <<  onfilename  << endl;
-  gLog << "Input OFF file/s: " <<  offfilename << endl;
-  
-
-  //----------------------------------------------------
-  MTaskList tliston;
-  MParList  pliston;
-
-  MTaskList tlistoff;
-  MParList  plistoff;
-  
-  // MReadMarsFile readon("Events", onfilename);
-  MReadTree readon("Parameters", onfilename);
-  readon.DisableAutoScheme();
-
-  // MReadMarsFile readoff("Events", offfilename);
-  MReadTree readoff("Parameters", offfilename);
-  readoff.DisableAutoScheme();
-  
-  MGeomCamMagic geomcam;
-
-  // set cuts to select an event sample to apply Disp
-  MFDisp *fdisp = NULL;
-  //      fdisp = new MFDisp;
-  //      fdisp->SetCuts(0,1,7,600,0,600,0.,3000000.,0.,0.,0.,0.,0.,0.);
-  //      MContinue contdisp(fdisp);
-
-  // Hadroness cut
-  TString hadrcut = "MHadronness.fHadronness<";
-  hadrcut += HadronnessCut;
-  gLog << "Hadronness Cut applied = " << hadrcut << endl;
-  MF hadrfilter(hadrcut);  
-  MContinue conthadr(&hadrfilter);
-  conthadr.SetInverted(kTRUE);
-
-  // Size cut
-  TString sizecut = "MHillas.fSize>";
-  sizecut += SizeCut;
-  gLog << "Size Cut applied = " << sizecut << endl;
-  MF sizefilter(sizecut);  
-  MContinue contsize(&sizefilter);
-  contsize.SetInverted(kTRUE);
-
-  // make Disp plots
-  // SelectedPos = 1  means choose the right source position
-  //               2                   wrong
-  //               3               the position according to M3Long
-  //               4               the position according to Asym
-  MHDisp hdispon;
-  hdispon.SetName("MHDispAsymOn");
-  hdispon.SetSelectedPos(4);
-  MFillH filldispon("MHDispAsymOn[MHDisp]", "");
-
-  MHDisp hdispoff;
-  hdispoff.SetName("MHDispAsymOff");
-  hdispoff.SetSelectedPos(4);
-  MFillH filldispoff("MHDispAsymOff[MHDisp]", "");
-  
-  
-  //*****************************
-  // entries in MParList On
-  pliston.AddToList(&tliston);
-  pliston.AddToList(&geomcam);
-  pliston.AddToList(&hdispon);
-
-  // entries in MParList Off
-  plistoff.AddToList(&tlistoff);
-  plistoff.AddToList(&geomcam);
-  plistoff.AddToList(&hdispoff);
-
-  
-  //*****************************
-  // entries in MTaskList On
-  tliston.AddToList(&readon);
-  if (fdisp != NULL)
-    tliston.AddToList(&contdisp);
-  tliston.AddToList(&conthadr);
-  tliston.AddToList(&contsize);
-  tliston.AddToList(&filldispon);
-
-  // entries in MTaskList Off
-  tlistoff.AddToList(&readoff);
-  if (fdisp != NULL)
-    tlist.AddToList(&contdisp);
-  tlistoff.AddToList(&conthadr);
-  tlistoff.AddToList(&contsize);
-  tlistoff.AddToList(&filldispoff);
-  
-  //*****************************
-  
-  //-------------------------------------------
-  // Execute event loop On
-  MProgressBar barOn;
-  MEvtLoop evtloopOn;
-  evtloopOn.SetParList(&pliston);
-  evtloopOn.SetProgressBar(&barOn);
-  
-  Int_t maxeventsOn = -1;
-  if ( !evtloopOn.Eventloop(maxeventsOn) )
-    return;
-  
-  tliston.PrintStatistics(0, kTRUE);
-
-  //-------------------------------------------
-  // Execute event loop Off
-  MProgressBar barOff;
-  MEvtLoop evtloopOff;
-  evtloopOff.SetParList(&plistoff);
-  evtloopOff.SetProgressBar(&barOff);
-  
-  Int_t maxeventsOff = -1;
-  if ( !evtloopOff.Eventloop(maxeventsOff) )
-    return;
-  
-  tlistoff.PrintStatistics(0, kTRUE);
-  
-
-  //-------------------------------------------
-  // Get the skymaps
-  TH2F *skymapOn  = hdispon.GetSkymapXY();
-  skymapOn->SetName("fSkymapXYOn");
-  skymapOn->SetTitle("ON DATA: Disp estimated source positions Skymap");
-  skymapOn->SetTitleOffset(1.2,"Y");
-  TH2F *skymapOff = hdispoff.GetSkymapXY();
-  skymapOff->SetName("fSkymapXYOff");
-  skymapOff->SetTitle("OFF DATA: Disp estimated source positions Skymap");
-  skymapOff->SetTitleOffset(1.2,"Y");
-
-  // Normalize to the number of events and subtract Off to On skymap
-  Double_t onentries  = skymapOn->GetEntries();
-  Double_t offentries = skymapOff->GetEntries();
-  Double_t norm = onentries/offentries;
-  cout << "Number of ON events after cuts = "  << onentries  << endl;
-  cout << "Number of OFF events after cuts = " << offentries << endl;
-  cout << "Normalization factor = " << norm << endl;
-
-  TH2F *skymap = new TH2F("fSkymapXY", 
-         "ON-OFF: Disp estimated source positions Skymap", 71, -2., 2., 71, -2., 2.);
-  skymap->Add(skymapOn,skymapOff,1.,-norm);
-  skymap->SetTitleOffset(1.2,"Y");
-  
-  //-------------------------------------------
-  // Display the skymaps
-  gLog << endl;
-  gLog << "Drawing DISP Skymaps for the FoV ...... "   << endl;
-  gLog << "(srcpos solution selected according Asym sign)" << endl; 
-
-  gStyle->SetPalette(1);
-  gStyle->SetOptStat(11);
-
-  TCanvas *c = new TCanvas("c","Disp Skymaps",0,0,900,900);    
-  c->SetBorderMode(0);
-  c->Divide(2,2);
-
-  c->cd(1);
-  gPad->SetBorderMode(0);
-  skymapOn->DrawClone("COLZ");
-  skymapOn->SetBit(kCanDelete);
-  gPad->Modified();
-
-  c->cd(2);
-  gPad->SetBorderMode(0);
-  skymapOff->DrawClone("COLZ");
-  skymapOff->SetBit(kCanDelete);
-  gPad->Modified();
-
-  c->cd(3);
-  gPad->SetBorderMode(0);
-  skymap->DrawClone("COLZ");
-  skymap->SetBit(kCanDelete);
-  gPad->Modified();
-
-  //-------------------------------------------
-  // Save the skymaps in a .root file
-  TFile outfile(outfilename,"RECREATE");
-  skymapOn->Write();
-  skymapOff->Write();
-  skymap->Write();
-  outfile.Close();
-  gLog << endl << "Skymaps stored in file: " << outfilename <<endl;
-
-  //-------------------------------------------
-  gLog << endl << "Disp plots were made for files: " << endl;
-  gLog << "ON data:  " << onfilename  << endl; 
-  gLog << "OFF data: " << offfilename << endl; 
-  gLog << "-----------------------------------------------------" << endl; 
-
-}
-
-
-
-
-
-
-
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha.C	(revision 6486)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/* ======================================================================== *\!
-!   Author(s): Oscar Blanch & Javier Rico
-\* ======================================================================== */
-
-void alpha(
-    Float_t cutsize=2000,
-    Float_t upcutsize=9999999,
-    Float_t lengthlowcut=0.,
-    Float_t lengthcut=0.26,
-    Float_t widthlowcut=0.,
-    Float_t widthcut=0.12
-)
-{    
-    // constants
-    const Int_t nbins = 9;
-    TString psname("alphaMrk.gif");
-    // general settings
-    gROOT->Reset();
-    gStyle->SetCanvasColor(0);
-    gStyle->SetCanvasBorderMode(0);
-    gStyle->SetPadBorderMode(0);
-    gStyle->SetFrameBorderMode(0);
-    gStyle->SetOptTitle(0);
-    gStyle->SetTitleOffset(1.7,"y");
-    gStyle->SetPadLeftMargin(0.15);
-    gStyle->SetOptStat(111110);
-    gStyle->SetStatColor(0);
-    gStyle->SetStatBorderSize(1);
-    gStyle->SetStatW(0.2);
-    gStyle->SetStatH(0.1);
-    gStyle->SetStatX(0.9);
-    gStyle->SetStatY(0.9);
-    
-    // define files, chain, trees, canvas...
-    TChain* ton= new TChain("Parameters");
-    
-    // ON data
-    ton->Add("/mnt/users/jrico/magic/mars/mars/mtemp/mifae/hillas/crab20040215OnRotateCalA-D.root");
-
-    TChain* toff= new TChain("Parameters");
-
-    // OFF data
-    toff->Add("/mnt/users/jrico/magic/mars/mars/mtemp/mifae/hillas/crab20040215OffRotateCalA-H.root");
-    
-    TCanvas *c1 = new TCanvas("c1","c1",800,500);
-    c1->cd(1);
-
-    // define aliases
-    ton->SetAlias("length","MHillas.fLength*0.6/189");
-    ton->SetAlias("width","MHillas.fWidth*0.6/189");
-    ton->SetAlias("dist","MHillasSrc.fDist*0.6/189");
-    ton->SetAlias("conc","MNewImagePar.fConc");
-    ton->SetAlias("size","MHillas.fSize");
-    ton->SetAlias("event","MRawEvtHeader.fDAQEvtNumber");
-    ton->SetAlias("alpha","abs(MHillasSrc.fAlpha)");
-    ton->SetAlias("leakage","MNewImagePar.fInnerLeakage1");
-    
-    toff->SetAlias("length","MHillas.fLength*0.6/189");
-    toff->SetAlias("width","MHillas.fWidth*0.6/189");
-    toff->SetAlias("dist","MHillasSrc.fDist*0.6/189");
-    toff->SetAlias("conc","MNewImagePar.fConc");
-    toff->SetAlias("size","MHillas.fSize");
-    toff->SetAlias("event","MRawEvtHeader.fDAQEvtNumber");
-    toff->SetAlias("alpha","abs(MHillasSrc.fAlpha)");
-    toff->SetAlias("leakage","MNewImagePar.fInnerLeakage1");
-
-    // define  cut(s)
-//    const char* eventcut="event%4==0 &&";
-    const char* eventcut="";
-    const char varcut[512];
-    //    sprintf(varcut,"size>%f && size<%f && length>%f  &&length<%f && width>%f &&  width<%f",cutsize,upcutsize,lengthlowcut,lengthcut,widthlowcut,widthcut);
-    sprintf(varcut,"size>%f && size<%f  && dist>0.2 && dist<1.1 && leakage==0 && length>%f  &&length<%f && width>%f &&  width<%f",cutsize,upcutsize,lengthlowcut,lengthcut,widthlowcut,widthcut);
-//    sprintf(varcut,"size>%f && dist>0.2 && dist<0.8 && length<0.21 && width<0.125",cutsize,upcutsize,lengthcut,widthcut);
-//    sprintf(varcut,"size>%f && size<%f  && dist>0.2 && dist<0.8 && length<0.21 && width<0.125",cutsize,upcutsize);
-//    sprintf(varcut,"size>%f && size<%f  && dist>0.2 && dist<0.8 && length<0.21",cutsize,upcutsize);
-//    sprintf(varcut,"size>%f && size<%f  && dist>0.2 && dist<0.8",cutsize,upcutsize);
-//    sprintf(varcut,"size>%f && size<%f",cutsize,upcutsize)
-//    sprintf(varcut,"");
-    Char_t cut[256];
-    Char_t cutoff[256];
-    strcat(cut,eventcut);
-    strcat(cut,varcut);
-    strcat(cutoff,varcut);
-
-    // fill on/off histos
-    TH1F* onhisto       = new TH1F("OnHist" ,"Alpha Plot",nbins,0,90);
-    TH1F* offhisto      = new TH1F("OffHist","Alpha Plot",nbins,0,90);    
-    ton->Draw("alpha>>OnHist",cut);
-    toff->Draw("alpha>>OffHist",cutoff);
-    cout << "Applied cut: " << cut << endl;
-    
-    // line/normalization
-    const Int_t inibin = 20./90.*nbins+1;
-    Float_t level=0;
-    Float_t leveloff=0;
-    Float_t levelofferror=0;
-    for(Int_t ibin = inibin; ibin<=nbins;ibin++)
-    {
-	level+=onhisto->GetBinContent(ibin);
-	leveloff+=offhisto->GetBinContent(ibin);
-    }
-    level/=(nbins-inibin+1);
-    leveloff/=(nbins-inibin+1);
-    
-    // normalize on/off
-    offhisto->Sumw2(); // needed to compute correct errors after normalization
-    const Float_t norm = level/leveloff;
-    cout << "Normalizing by factor " << norm <<endl;
-    offhisto->Scale(norm);    
-
-    // significance:
-    Float_t sig=0,bg=0,esig=0,ebg=0;
-    Float_t significance=0;
-    const Int_t signbins = inibin-1;
-    for(Int_t ibin = 1; ibin<=signbins;ibin++)
-    {
-//	Float_t sigma = (onhisto->GetBinContent(ibin)-level)/onhisto->GetBinError(ibin);
-//	significance+=sigma*sigma;
-	sig  += onhisto->GetBinContent(ibin);
-	esig += onhisto->GetBinError(ibin)*onhisto->GetBinError(ibin);
-	bg   += offhisto->GetBinContent(ibin);
-	ebg  += offhisto->GetBinError(ibin)*offhisto->GetBinError(ibin);
-    }
-    Float_t error= TMath::Sqrt(esig+ebg);
-    significance = (sig-bg)/error;
-    
-    cout << "Excess: " << sig-bg << endl;
-    cout << "N bkg: "  << bg << endl; 
-    cout << "Significance: " << significance << endl;
-
-    // plot
-    onhisto->SetXTitle("alpha (deg)");
-    onhisto->SetYTitle("Entries");
-    onhisto->SetMarkerColor(4);
-    onhisto->SetMarkerStyle(20);
-    onhisto->SetMarkerSize(.7);
-    onhisto->SetLineColor(4);
-    onhisto->SetMaximum(onhisto->GetBinContent(nbins)*1.5);
-
-    offhisto->SetFillColor(2);
-    offhisto->SetMaximum(offhisto->GetBinContent(nbins)*1.5);
-    offhisto->SetXTitle("alpha (deg)");
-    offhisto->SetYTitle("Entries");
-
-    offhisto->Draw("HIST");
-    offhisto->Draw("ESAME");
-    onhisto->Draw("ESAMES");
-    //    onhisto->Draw("E");
-
-    // move stat box to make them all visible
-    gPad->Update();
-    TPaveStats* offpavstat = (TPaveStats*) offhisto->GetListOfFunctions()->FindObject("stats");
-    if(offpavstat)
-    {
-	Float_t shiftx = offpavstat->GetX2NDC()-offpavstat->GetX1NDC();
-	offpavstat->SetX1NDC(offpavstat->GetX1NDC()-shiftx);
-	offpavstat->SetX2NDC(offpavstat->GetX2NDC()-shiftx);
-    }
-
-    // draw line
-    TLine* line = new TLine(0.,level,90.,level);
-    line->SetLineColor(2);
-    line->SetLineStyle(2);
-//    line->Draw();
-
-    gPad->Modified();
-    gPad->Update();
-
-    // produce ps
-    //  char psname[50];
-    //  sprintf(psname,"%s.ps",var);
-    c1->Print(psname);
-}
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha_plot.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/alpha_plot.C	(revision 6486)
+++ 	(revision )
@@ -1,835 +1,0 @@
-Double_t ChiSquareNDof(TH1D *h1, TH1D *h2)
-{
-    Double_t chiq = 0.;
-    Double_t chi;
-    Double_t error;
-    Int_t nbinsnozero = 0;
-
-    Int_t nbins = h1->GetNbinsX();
-    if (nbins != h2->GetNbinsX() || nbins == 0)
-	return -1;
-
-    for (UInt_t bin=1; bin<=nbins; bin++)
-    {
-	error = sqrt(h1->GetBinError(bin)*h1->GetBinError(bin) +
-			   h2->GetBinError(bin)*h2->GetBinError(bin));
-	if (error != 0)
-	{
-	    chi = (h1->GetBinContent(bin)-h2->GetBinContent(bin))/error;
-	    chiq += chi*chi;
-	    nbinsnozero++;
-	}
-    }
-
-    return chiq/nbinsnozero;
-}
-
-void alpha_plot(TString f_on_name  = "../HillasFiles/Mrk421/*_H.root",
-		TString f_off_name = "../HillasFiles/OffMrk421/*_H.root",
-		TString f_src_name = "../HillasFiles/20040319_OffMrk421.fake.pos")	     
-{
-
-    const UInt_t numEntries = 100000000;
-    
-    //cuts
-    Float_t sizemin   = 2000.; //[ADC]
-    Float_t sizemax   = 10000000000.; //[ADC]
-    Float_t widthmin  = 0.06; 
-    Float_t widthmax  = 0.12;
-    Float_t lengthmin = 0.10; 
-    Float_t lengthmax = 0.26;
-    Float_t distmin   = 0.3; 
-    Float_t distmax   = 1.2;
-    Float_t alphamin   = 0.; 
-    Float_t alphamax   = 90.;
-
-    //integration
-    Float_t sigexccmin = 0.;
-    Float_t sigexccmax = 30.;
-    Float_t bkgnormmin = 30.;
-    Float_t bkgnormmax = 90.;
-    
-    gStyle->SetOptStat(111111);
-    gStyle->SetOptFit();
-    
-    //
-    // Make a loop only for the ON data:
-    //
-    
-    MParList plist_on;
-    MTaskList tlist_on;
-    plist_on.AddToList(&tlist_on);
-  
-    // ON containers
-    MGeomCamMagic geomcam;
-    MSrcPosCam source_on;
-    MHillas hillas;
-    MHillasSrc hillasscr;
-    
-    plist_on.AddToList(&geomcam);
-    plist_on.AddToList(&source_on);
-    plist_on.AddToList(&hillas);
-    plist_on.AddToList(&hillasscr);
-    
-    //create some 1-dim histo to test only for the ON distribution of dist, width , length, size...
-    MH3 hDist_on("MHillasSrc.fDist/315.");
-    hDist_on.SetName("Dist_on");
-    plist_on.AddToList(&hDist_on);
-    MBinning binsDist_on("BinningDist_on");
-    Int_t nbins_Dist = 20;
-    Float_t min_Dist = 0.;
-    Float_t max_Dist = distmax*1.2;
-    binsDist_on.SetEdges(nbins_Dist, min_Dist, max_Dist);
-    plist_on.AddToList(&binsDist_on);
-    
-    MH3 hWidth_on("MHillas.fWidth/315.");
-    hWidth_on.SetName("Width_on");
-    plist_on.AddToList(&hWidth_on);
-    MBinning binsWidth_on("BinningWidth_on");
-    Int_t nbins_Width = 20;
-    Float_t min_Width = 0.;
-    Float_t max_Width = widthmax*1.2;
-    binsWidth_on.SetEdges(nbins_Width, min_Width, max_Width);
-    plist_on.AddToList(&binsWidth_on);
-    
-    MH3 hLength_on("MHillas.fLength/315.");
-    hLength_on.SetName("Length_on");
-    plist_on.AddToList(&hLength_on);
-    MBinning binsLength_on("BinningLength_on");
-    Int_t nbins_Length = 20;
-    Float_t min_Length = 0.;
-    Float_t max_Length =  lengthmax*1.2;
-    binsLength_on.SetEdges(nbins_Length, min_Length, max_Length);
-    plist_on.AddToList(&binsLength_on);
-    
-    MH3 hSize_on("log10(MHillas.fSize)");
-    hSize_on.SetName("Size_on");
-    plist_on.AddToList(&hSize_on);
-    MBinning binsSize_on("BinningSize_on");
-    Int_t nbins_Size = 60;
-    Float_t min_Size = log10(sizemin)*0.8;
-    Float_t max_Size = log10(1000000)*1.2;
-    binsSize_on.SetEdges(nbins_Size, min_Size, max_Size);
-    plist_on.AddToList(&binsSize_on);
-    
-    //create a histo to fill the alpha values: one alpha plot form 0 to +90 deg in abs value
-    MH3 hAlpha_on_abs("abs(MHillasSrc.fAlpha)");
-    hAlpha_on_abs.SetName("Alpha_on_abs");
-    plist_on.AddToList(&hAlpha_on_abs);
-    MBinning binsAlpha_on_abs("BinningAlpha_on_abs");
-    Int_t nbins_abs = 9;
-    Float_t minalpha_abs = 0.;
-    Float_t maxalpha_abs =90.;
-    binsAlpha_on_abs.SetEdges(nbins_abs, minalpha_abs, maxalpha_abs);
-    plist_on.AddToList(&binsAlpha_on_abs);
-    
-    //create a histo to fill the alpha values: one alpha plot form -90 to +90 deg.
-    MH3 hAlpha_on("MHillasSrc.fAlpha");
-    hAlpha_on.SetName("Alpha_on");
-    plist_on.AddToList(&hAlpha_on);
-    MBinning binsAlpha_on("BinningAlpha_on");
-    Int_t nbins = nbins_abs*2;
-    Float_t minalpha = -90.;
-    Float_t maxalpha =  90.;
-    binsAlpha_on.SetEdges(nbins, minalpha, maxalpha);
-    plist_on.AddToList(&binsAlpha_on);
-    
-
-    MH3 hSrcPos_on("MSrcPosCam.fX","MSrcPosCam.fY");
-    hSrcPos_on.SetName("SrcPos_on");
-    plist_on.AddToList(&hSrcPos_on);
-    MBinning binsSrcPos_onX("BinningSrcPos_onX");
-    MBinning binsSrcPos_onY("BinningSrcPos_onY");
-    Int_t nbins_srcpos = 400;
-    Float_t minsrcpos = -600.;
-    Float_t maxsrcpos =  600.;
-    binsSrcPos_onX.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos);
-    binsSrcPos_onY.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos);
-    plist_on.AddToList(&binsSrcPos_onX);
-    plist_on.AddToList(&binsSrcPos_onY);
-
-    MH3 hDAQEvtNumber_on("MRawEvtHeader.fDAQEvtNumber");
-    hDAQEvtNumber_on.SetName("DAQEvtNumber_on");
-    plist_on.AddToList(&hDAQEvtNumber_on);
-    MBinning binsDAQEvtNumber_onX("BinningDAQEvtNumber_onX");
-    Int_t nbins_evtnum = 1000;
-    Float_t minevtnum =  0.;
-    Float_t maxevtnum =  1000.;
-    binsDAQEvtNumber_onX.SetEdges(nbins_evtnum,minevtnum,maxevtnum);
-    plist_on.AddToList(&binsDAQEvtNumber_onX);
-
-    //
-    //tasks
-    //
-    
-    MReadTree read_on("Parameters", f_on_name);
-    read_on.DisableAutoScheme();
- 
-
-    //cuts
-    TString sizestr = "(MHillas.fSize < ";
-    sizestr += sizemin;
-    sizestr += ") || (";
-    sizestr += "MHillas.fSize > ";
-    sizestr += sizemax;
-    sizestr += ")";
-    MF sizefilter(sizestr);
-    
-    TString widthstr = "({MHillas.fWidth/315.} < ";
-    widthstr += widthmin;
-    widthstr += ") || (";
-    widthstr += "{MHillas.fWidth/315.} > ";
-    widthstr += widthmax;
-    widthstr += ")";
-    MF widthfilter(widthstr);
-    
-    TString lengthstr = "({MHillas.fLength/315.} < ";
-    lengthstr += lengthmin;
-    lengthstr += ") || (";
-    lengthstr += "{MHillas.fLength/315.} > ";
-    lengthstr += lengthmax;
-    lengthstr += ")";
-    MF lengthfilter(lengthstr);
-    
-    TString diststr = "({MHillasSrc.fDist/315.} < ";
-    diststr += distmin;
-    diststr += ") || (";
-    diststr += "{MHillasSrc.fDist/315.} > ";
-    diststr += distmax;
-    diststr += ")";
-    MF distfilter(diststr);
-    
-    TString alphastr = "({abs(MHillasSrc.fAlpha)} < ";
-    alphastr += alphamin;
-    alphastr += ") || (";
-    alphastr += "{abs(MHillasSrc.fAlpha)} > ";
-    alphastr += alphamax;
-    alphastr += ")";
-    MF alphafilter(alphastr);
-    
-    MF evenfilter("{MRawEvtHeader.fDAQEvtNumber%3}<0.5");
-    MF oddfilter("{MRawEvtHeader.fDAQEvtNumber%3}>0.5");
-
-    MContinue cont_size(&sizefilter);
-    MContinue cont_width(&widthfilter);
-    MContinue cont_length(&lengthfilter);
-    MContinue cont_dist(&distfilter);
-    MContinue cont_alpha(&alphafilter);
-    MContinue cont_even(&evenfilter);
-    MContinue cont_odd(&oddfilter);
-    
-    //    MSrcPosFromFile srccalc(f_src_name);
-    MSrcPlace srccalc;
-    
-    MHillasSrcCalc csrc_on;
-
-    // fill all histograms
-    MFillH falpha_on_abs(&hAlpha_on_abs);
-    MFillH falpha_on(&hAlpha_on);
-    MFillH fdist_on(&hDist_on);
-    MFillH fwidth_on(&hWidth_on);
-    MFillH flength_on(&hLength_on);
-    MFillH fsize_on(&hSize_on);
-    MFillH fsrcpos_on(&hSrcPos_on);
-    MFillH fevtnum_on(&hDAQEvtNumber_on);
-    
-
-    // prints
-    MPrint pevent("MRawEvtHeader");
-    MPrint phillas("MHillas");
-    MPrint phillassrc("MHillasSrc");
-    MPrint psrcpos("MSrcPosCam");
-
-    //tasklist
-    tlist_on.AddToList(&read_on);
-    tlist_on.AddToList(&srccalc);
-    tlist_on.AddToList(&csrc_on);
-    tlist_on.AddToList(&fsrcpos_on);
-//    tlist_on.AddToList(&cont_odd);
-    tlist_on.AddToList(&cont_size);
-    tlist_on.AddToList(&cont_width);
-    tlist_on.AddToList(&cont_length);
-    tlist_on.AddToList(&cont_dist);
-    tlist_on.AddToList(&cont_alpha);
-    tlist_on.AddToList(&falpha_on_abs);
-    tlist_on.AddToList(&falpha_on);
-    tlist_on.AddToList(&fdist_on);
-    tlist_on.AddToList(&fwidth_on);
-    tlist_on.AddToList(&flength_on);
-    tlist_on.AddToList(&fsize_on);
-    tlist_on.AddToList(&fevtnum_on);
-    
-    // Create and setup the eventloop
-    MEvtLoop loop_on;
-    loop_on.SetParList(&plist_on);
-  //loop_on.SetDisplay(display);
-    
-    MProgressBar bar;
-    loop_on.SetProgressBar(&bar);
-    
-    if (!loop_on.Eventloop(numEntries))
-	return;
-
-    tlist_on.PrintStatistics();
-    
-    // 
-    // Make a loop only for the OFF data:
-    //
-    
-    MParList plist_off;
-    MTaskList tlist_off;
-    plist_off.AddToList(&tlist_off);
-    
-    MSrcPosCam source_off;
-
-    plist_off.AddToList(&geomcam);
-    plist_off.AddToList(&source_off);
-    plist_off.AddToList(&hillas);
-    plist_off.AddToList(&hillasscr);
-
-    //create some 1-dim histo to test only for the OFF distribution of dist, width , length, size...
-    MH3 hDist_off("MHillasSrc.fDist/315.");
-    hDist_off.SetName("Dist_off");
-    plist_off.AddToList(&hDist_off);
-    MBinning binsDist_off("BinningDist_off");
-    binsDist_off.SetEdges(nbins_Dist, min_Dist, max_Dist);
-    plist_off.AddToList(&binsDist_off);
-    
-    MH3 hWidth_off("MHillas.fWidth/315.");
-    hWidth_off.SetName("Width_off");
-    plist_off.AddToList(&hWidth_off);
-    MBinning binsWidth_off("BinningWidth_off");
-    binsWidth_off.SetEdges(nbins_Width, min_Width, max_Width);
-    plist_off.AddToList(&binsWidth_off);
-
-    MH3 hLength_off("MHillas.fLength/315.");
-    hLength_off.SetName("Length_off");
-    plist_off.AddToList(&hLength_off);
-    MBinning binsLength_off("BinningLength_off");
-    binsLength_off.SetEdges(nbins_Length, min_Length, max_Length);
-    plist_off.AddToList(&binsLength_off);
-    
-    MH3 hSize_off("log10(MHillas.fSize)");
-    hSize_off.SetName("Size_off");
-    plist_off.AddToList(&hSize_off);
-    MBinning binsSize_off("BinningSize_off");
-    binsSize_off.SetEdges(nbins_Size, min_Size, max_Size);
-    plist_off.AddToList(&binsSize_off);
-    
-    //create a histo to fill the alpha values: from 0 to 90 deg -> abs value
-    MH3 hAlpha_off_abs("abs(MHillasSrc.fAlpha)");
-    hAlpha_off_abs.SetName("Alpha_off_abs");
-    plist_off.AddToList(&hAlpha_off_abs);
-    MBinning binsAlpha_off_abs("BinningAlpha_off_abs");
-    binsAlpha_off_abs.SetEdges(nbins_abs, minalpha_abs, maxalpha_abs);
-    plist_off.AddToList(&binsAlpha_off_abs);
-    
-    //create a histo to fill the alpha values: from -90 to 90 deg
-    MH3 hAlpha_off("MHillasSrc.fAlpha");
-    hAlpha_off.SetName("Alpha_off");
-    plist_off.AddToList(&hAlpha_off);
-    MBinning binsAlpha_off("BinningAlpha_off");
-    binsAlpha_off.SetEdges(nbins, minalpha, maxalpha);
-    plist_off.AddToList(&binsAlpha_off);
-    
-    
-    MH3 hSrcPos_off("MSrcPosCam.fX","MSrcPosCam.fY");
-    hSrcPos_off.SetName("SrcPos_off");
-    plist_off.AddToList(&hSrcPos_off);
-    MBinning binsSrcPos_offX("BinningSrcPos_offX");
-    MBinning binsSrcPos_offY("BinningSrcPos_offY");
-    binsSrcPos_offX.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos);
-    binsSrcPos_offY.SetEdges(nbins_srcpos, minsrcpos, maxsrcpos);
-    plist_off.AddToList(&binsSrcPos_offX);
-    plist_off.AddToList(&binsSrcPos_offY);
-
-    MH3 hDAQEvtNumber_off("MRawEvtHeader.fDAQEvtNumber");
-    hDAQEvtNumber_off.SetName("DAQEvtNumber_off");
-    plist_off.AddToList(&hDAQEvtNumber_off);
-    MBinning binsDAQEvtNumber_offX("BinningDAQEvtNumber_offX");
-    Int_t nbins_evtnum = 100;
-    Float_t minevtnum =  0.;
-    Float_t maxevtnum =  100.;
-    binsDAQEvtNumber_offX.SetEdges(nbins_evtnum,minevtnum,maxevtnum);
-    plist_off.AddToList(&binsDAQEvtNumber_offX);
-
-   //tasks
-    MReadTree read_off("Parameters", f_off_name);
-    read_off.DisableAutoScheme();
-    
-    srccalc.SetMode(MSrcPlace::kOff);
-
-    MHillasSrcCalc csrc_off;
-
-    // fill all histograms
-    MFillH falpha_off_abs(&hAlpha_off_abs);
-    MFillH falpha_off(&hAlpha_off);
-    MFillH fdist_off(&hDist_off);
-    MFillH fwidth_off(&hWidth_off);
-    MFillH flength_off(&hLength_off);
-    MFillH fsize_off(&hSize_off);
-    MFillH fsrcpos_off(&hSrcPos_off);
-    MFillH fevtnum_off(&hDAQEvtNumber_off);
-   
-    //tasklist
-    tlist_off.AddToList(&read_off);
-    tlist_off.AddToList(&srccalc);
-    tlist_off.AddToList(&csrc_off);
-    tlist_off.AddToList(&fsrcpos_off);
-//    tlist_off.AddToList(&cont_even);
-    tlist_off.AddToList(&cont_size);
-    tlist_off.AddToList(&cont_width);
-    tlist_off.AddToList(&cont_length);
-    tlist_off.AddToList(&cont_dist);
-    tlist_off.AddToList(&cont_alpha);
-    tlist_off.AddToList(&falpha_off_abs);
-    tlist_off.AddToList(&falpha_off);
-    tlist_off.AddToList(&fdist_off);
-    tlist_off.AddToList(&fwidth_off);
-    tlist_off.AddToList(&flength_off);
-    tlist_off.AddToList(&fsize_off);
-    tlist_off.AddToList(&fevtnum_off);
-     
-    // Create and setup the eventloop
-    MEvtLoop loop_off;
-    loop_off.SetParList(&plist_off);
-    //loop_off.SetDisplay(display);
-    
-    MProgressBar bar_off;
-    loop_off.SetProgressBar(&bar_off);
-    
-    if (!loop_off.Eventloop(numEntries))
-	return;
-    
-    tlist_off.PrintStatistics();
-    
-  // ############################################################################
-  //  look for the histograms
-  // ############################################################################
-
-  TH1F *hist_size_on = (TH1F*)hSize_on.GetHist();
-  TH1F *hist_size_off = (TH1F*)hSize_off.GetHist();
-
-  TH1F *hist_dist_on = (TH1F*)hDist_on.GetHist();
-  TH1F *hist_dist_off = (TH1F*)hDist_off.GetHist();
-
-  TH1F *hist_width_on = (TH1F*)hWidth_on.GetHist();
-  TH1F *hist_width_off = (TH1F*)hWidth_off.GetHist();
-
-  TH1F *hist_length_on = (TH1F*)hLength_on.GetHist();
-  TH1F *hist_length_off = (TH1F*)hLength_off.GetHist();
-
-  TH1F *hist_on_abs = (TH1F*)hAlpha_on_abs.GetHist();
-  TH1F *hist_off_abs = (TH1F*)hAlpha_off_abs.GetHist();
-
-  TH1F *hist_on = (TH1F*)hAlpha_on.GetHist();
-  TH1F *hist_off = (TH1F*)hAlpha_off.GetHist();
-
-
-  // ############################################################################
-  // Calculate significance and excess: 
-  // ############################################################################
-
-  Double_t norm_on_abs  = (Double_t) hist_on_abs->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1);
-  Double_t exces_on_abs = (Double_t) hist_on_abs->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1);
-  Double_t norm_off_abs  = (Double_t) hist_off_abs->Integral((Int_t)bkgnormmin*nbins_abs/90+1,(Int_t)bkgnormmax*nbins_abs/90+1);
-  Double_t exces_off_abs = (Double_t) hist_off_abs->Integral((Int_t)sigexccmin*nbins_abs/90+1,(Int_t)sigexccmax*nbins_abs/90+1);
-  Double_t norm = norm_on_abs/norm_off_abs;
-
-  char text_tit_alpha[256];
-  sprintf(text_tit_alpha, " Alpha Plot On and Off ");
-  hist_off_abs->SetTitle(text_tit_alpha);
-  hist_on_abs->SetTitle(text_tit_alpha);
-
-  Double_t excess  = exces_on_abs - exces_off_abs*norm;
-  Double_t sign    = excess / sqrt( exces_on_abs + norm*norm*exces_off_abs );
-  Double_t int_off = (Double_t) hist_off_abs->Integral(1, 18);
-  int hist_on_entries  = (int) hist_on_abs->GetEntries();
-  int hist_off_entries = (int) hist_off_abs->GetEntries();
-    
-  cout << "---> Normalization F factor =\t" << norm <<endl;
-  cout << "---> Excess =\t\t\t" << excess <<endl;
-  cout << "---> Significancia =\t\t" << sign <<endl;    
-  cout << "---> entries on   =\t\t" << hist_on_entries  <<endl;
-  cout << "---> entries off  =\t\t" << hist_off_entries <<endl;
-  cout << "---> integral off =\t\t" << int_off <<endl;
-
-  Float_t shiftx;
-
-  //
-  //Create the display -> from now on, all histos are plotted
-  MStatusDisplay *display = new MStatusDisplay;
-  display->SetUpdateTime(3000);
-  display->Resize(850,700);
-  
-  // ############################################################################
-  // Draw SIZE
-  // ############################################################################
-  display->AddTab("SIZE");
-
-  gPad->cd();
-
-  gPad->SetLogy();
-  hist_size_on->Sumw2();
-  hist_size_off->Sumw2();
-  hist_size_off->Scale(norm); 
-  hist_size_on->SetLineColor(kBlack);
-  hist_size_on->SetMarkerStyle(21);
-  hist_size_on->SetMarkerSize(0.7);
-  hist_size_on->SetMarkerColor(kBlack);
-  hist_size_off->SetFillColor(46);
-  hist_size_off->SetLineColor(46);
-  hist_size_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_size_off->SetMinimum(0.1);
-  hist_size_on->SetMinimum(0.1);
-  hist_size_on->SetTitle("SIZE distribution");
-  hist_size_off->SetTitle("SIZE distribution");
-
-  hist_size_on->DrawCopy("E1P");
-
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* pavs_on_size = (TPaveStats*) hist_size_on->GetListOfFunctions()->FindObject("stats");
-  if(pavs_on_size){
-    shiftx = pavs_on_size->GetX2NDC() - pavs_on_size->GetX1NDC();
-    pavs_on_size->SetX1NDC(pavs_on_size->GetX1NDC() - shiftx);
-    pavs_on_size->SetX2NDC(pavs_on_size->GetX2NDC() - shiftx);  
-  }
-  gPad->Modified();
-  gPad->Update();
-
-  hist_size_off->DrawCopy("HISTSAME");
-  hist_size_off->DrawCopy("ESAME");
-
-  gPad->Modified();
-  gPad->Update();
-
-  Double_t chisize = ChiSquareNDof((TH1D*)hist_size_on,(TH1D*)hist_size_off);
-
-  Double_t x_label_pos  = log10(1000000)*0.7;
-  Double_t y_label_pos  = log10((hist_size_on->GetBinContent(hist_size_on->GetMaximumBin()))/2.);
-  Double_t textsize = 0.03;
-
-  char text_size[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chisize);
-
-  TLatex *tsize = new TLatex(x_label_pos, y_label_pos, text_size);
-  tsize->SetTextSize(textsize);
-//  tsize->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-  // ############################################################################
-  // DrawCopy DIST
-  // ############################################################################
-  display->AddTab("DIST");
-
-  gPad->cd();
-
-  hist_dist_on->Sumw2();
-  hist_dist_off->Sumw2();
-  hist_dist_off->Scale(norm); 
-  hist_dist_on->SetLineColor(kBlack);
-  hist_dist_on->SetMarkerStyle(21);
-  hist_dist_on->SetMarkerSize(0.7);
-  hist_dist_on->SetMarkerColor(kBlack);
-  hist_dist_off->SetFillColor(46);
-  hist_dist_off->SetLineColor(46);
-  hist_dist_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_dist_off->SetMinimum(0.);
-  hist_dist_on->SetTitle("DIST distribution");
-  hist_dist_off->SetTitle("DIST distribution");
-
-  hist_dist_on->DrawCopy("E1P");
-
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* pavs_on_dist = (TPaveStats*) hist_dist_on->GetListOfFunctions()->FindObject("stats");
-  if(pavs_on_dist){
-    shiftx = pavs_on_dist->GetX2NDC() - pavs_on_dist->GetX1NDC();
-    pavs_on_dist->SetX1NDC(pavs_on_dist->GetX1NDC() - shiftx);
-    pavs_on_dist->SetX2NDC(pavs_on_dist->GetX2NDC() - shiftx);  
-  }
-  gPad->Modified();
-  gPad->Update();
-
-  hist_dist_off->DrawCopy("HISTSAME");
-  hist_dist_off->DrawCopy("ESAME");
-  hist_dist_on->DrawCopy("E1PSAME");
-
-  Double_t chidist = ChiSquareNDof((TH1D*)hist_dist_on,(TH1D*)hist_dist_off);
-
-  x_label_pos  = distmax*0.7;
-  y_label_pos  = hist_dist_on->GetBinContent(hist_dist_on->GetMaximumBin())/2.;
-
-  char text_dist[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chidist);
-
-  TLatex *tdist = new TLatex(x_label_pos, y_label_pos, text_dist);
-  tdist->SetTextSize(textsize);
-//  tdist->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-   // ############################################################################
-  // DrawCopy WIDTH
-  // ############################################################################
-  display->AddTab("WIDTH");
-
-  gPad->cd();
-
-  hist_width_off->Sumw2();
-  hist_width_off->Scale(norm); 
-  hist_width_on->SetLineColor(kBlack);
-  hist_width_on->SetMarkerStyle(21);
-  hist_width_on->SetMarkerSize(0.7);
-  hist_width_on->SetMarkerColor(kBlack);
-  hist_width_off->SetFillColor(46);
-  hist_width_off->SetLineColor(46);
-  hist_width_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_width_off->SetMinimum(0.);
-  hist_width_on->SetTitle("WIDTH distribution");
-  hist_width_off->SetTitle("WIDTH distribution");
-
-  hist_width_on->DrawCopy("E1P");
-
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* pavs_on_width = (TPaveStats*) hist_width_on->GetListOfFunctions()->FindObject("stats");
-  if(pavs_on_width){
-    shiftx = pavs_on_width->GetX2NDC() - pavs_on_width->GetX1NDC();
-    pavs_on_width->SetX1NDC(pavs_on_width->GetX1NDC() - shiftx);
-    pavs_on_width->SetX2NDC(pavs_on_width->GetX2NDC() - shiftx);  
-  }
-  gPad->Modified();
-  gPad->Update();
-
-  hist_width_off->DrawCopy("HISTSAME");
-  hist_width_off->DrawCopy("ESAME");
-  hist_width_on->DrawCopy("E1PSAME");
-
-  Double_t chiwidth = ChiSquareNDof((TH1D*)hist_width_on,(TH1D*)hist_width_off);
-
-  x_label_pos  = widthmax*0.7;
-  y_label_pos  = hist_width_on->GetBinContent(hist_width_on->GetMaximumBin())/2.;
-
-  char text_width[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chiwidth);
-
-  TLatex *twidth = new TLatex(x_label_pos, y_label_pos, text_width);
-  twidth->SetTextSize(textsize);
-//  twidth->Draw();
-
-  gPad->Modified();
-  gPad->Update();
- 
-  // ############################################################################
-  // DrawCopy LENGTH
-  // ############################################################################
-  display->AddTab("LENGTH");
- 
-  gPad->cd();
-
-  hist_length_on->Sumw2();
-  hist_length_off->Sumw2();
-  hist_length_off->Scale(norm); 
-  hist_length_on->SetLineColor(kBlack);
-  hist_length_on->SetMarkerStyle(21);
-  hist_length_on->SetMarkerSize(0.7);
-  hist_length_on->SetMarkerColor(kBlack);
-  hist_length_off->SetFillColor(46);
-  hist_length_off->SetLineColor(46);
-  hist_length_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_length_off->SetMinimum(0.);
-  hist_length_on->SetTitle("LENGTH distribution");
-  hist_length_off->SetTitle("LENGTH distribution");
-
-  hist_length_on->DrawCopy("E1P");
-
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* pavs_on_length = (TPaveStats*) hist_length_on->GetListOfFunctions()->FindObject("stats");
-  if(pavs_on_length){
-    shiftx = pavs_on_length->GetX2NDC() - pavs_on_length->GetX1NDC();
-    pavs_on_length->SetX1NDC(pavs_on_length->GetX1NDC() - shiftx);
-    pavs_on_length->SetX2NDC(pavs_on_length->GetX2NDC() - shiftx);  
-  }
-  gPad->Modified();
-  gPad->Update();
-
-  hist_length_off->DrawCopy("HISTSAME");
-  hist_length_off->DrawCopy("ESAME");
-  hist_length_on->DrawCopy("E1PSAME");
-
-  Double_t chilength = ChiSquareNDof((TH1D*)hist_length_on,(TH1D*)hist_length_off);
-
-  x_label_pos  = lengthmax*0.7;
-  y_label_pos  = hist_length_on->GetBinContent(hist_length_on->GetMaximumBin())/2.;
-
-  char text_length[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chilength);
-
-  TLatex *tlength = new TLatex(x_label_pos, y_label_pos, text_length);
-  tlength->SetTextSize(textsize);
-//  tlength->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-  // ############################################################################
-  // DrawCopy normalized ALPHA plot
-  // ############################################################################
-  display->AddTab("ALPHA");
-  
-  gPad->cd();
-
-  hist_on_abs->Sumw2();
-  hist_off_abs->SetStats(0);
-  hist_off_abs->Sumw2();
-  hist_off_abs->Scale(norm); 
-  hist_on_abs->SetStats(0); //-> Do NOT show the legend with statistics
-  hist_on_abs->SetLineColor(kBlack);
-  hist_on_abs->SetMarkerStyle(21);
-  //hist_on_abs->SetMarkerSize();
-  hist_on_abs->SetMarkerColor(kBlack);
-  hist_on_abs->SetMarkerSize(0.7);
-  hist_off_abs->SetFillColor(46);
-  hist_off_abs->SetLineColor(46);
-  hist_off_abs->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_off_abs->SetMinimum(0.);
-  hist_on_abs->SetTitle("Alpha plot");
-  hist_off_abs->SetTitle("Alpha plot");
-
-  
-  hist_on_abs->DrawCopy("E1P");
-  hist_off_abs->DrawCopy("HISTSAME");
-  hist_off_abs->DrawCopy("ESAME");
-  hist_on_abs->DrawCopy("E1PSAME");
-
-
-   //draw the LEGEND with excess and significance values in the alpha plot:
-  char text_Fnorm[256], text_excess[256], text_sign[256];
-  char text_entries_on[256], text_entries_off[256], text_integral_off[256];
-  int hist_on_entries  = (int) hist_on_abs->GetEntries();
-  int hist_off_entries = (int) hist_off_abs->GetEntries();
-  sprintf(text_Fnorm,       " F norm =       %.3f", norm);
-  sprintf(text_excess,      " Excess =       %.3f", excess);
-  sprintf(text_sign,        " Significance = %.3f", sign);
-  sprintf(text_entries_on,  " Entries ON   = %d",  hist_on_entries);
-  sprintf(text_entries_off, " Entries OFF  = %d",  hist_off_entries);
-  sprintf(text_integral_off," Integral OFF = %d",  int_off);
-  
-  x_label_pos  = alphamax*0.7;
-  y_label_pos  = (hist_on_abs->GetBinContent(hist_on_abs->GetMaximumBin()))/1.6; //2.;
-  Double_t y_label_step = y_label_pos / 8.;
-
-  TLatex *t0 = new TLatex(x_label_pos, y_label_pos - y_label_step*0, text_Fnorm);
-  t0->SetTextSize(textsize);
-  t0->Draw();
-  TLatex *t1 = new TLatex(x_label_pos, y_label_pos - y_label_step*1, text_excess);
-  t1->SetTextSize(textsize);
-  t1->Draw();
-  TLatex *t2 = new TLatex(x_label_pos, y_label_pos - y_label_step*2, text_sign);
-  t2->SetTextSize(textsize);
-  t2->Draw();
-  TLatex *t3 = new TLatex(x_label_pos, y_label_pos - y_label_step*3, text_entries_on);
-  t3->SetTextSize(textsize);
-  t3->Draw();
-  TLatex *t4 = new TLatex(x_label_pos, y_label_pos - y_label_step*4, text_entries_off);
-  t4->SetTextSize(textsize);
-  t4->Draw();
-  TLatex *t5 = new TLatex(x_label_pos, y_label_pos - y_label_step*5, text_integral_off);
-  t5->SetTextSize(textsize);
-  t5->Draw();
-  
-
-  Double_t chialpha = ChiSquareNDof((TH1D*)hist_on_abs,(TH1D*)hist_off_abs);
-
-  y_label_pos  = (hist_on_abs->GetBinContent(hist_on_abs->GetMaximumBin()))/2.;
-
-  char text_alpha[256];
-  sprintf(text_size,"ChiSquare/NDof = %4.2f",chialpha);
-
-  TLatex *talpha = new TLatex(x_label_pos, y_label_pos, text_alpha);
-  talpha->SetTextSize(textsize);
-//  talpha->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-  // ############################################################################
-  // DrawCopy normalized alpha histos for alpha form -90 to 90 deg.
-  // ############################################################################
-  display->AddTab("ALPHA +-90");
-
-  gPad->cd();
-
-  hist_on->Sumw2();
-  hist_off->SetStats(0);
-  hist_off->Sumw2();
-  hist_off->Scale(norm); 
-  hist_off->SetFillColor(46);
-  hist_off->SetLineColor(46);
-  hist_off->SetFillStyle(3004); //(1001)-> To set the pad NOT transparent and solid; (3004)-> pattern lines
-  hist_off->SetMinimum(0.); 
-  hist_on->SetStats(0); //-> Do NOT show the legend with statistics
-  hist_on->SetLineColor(kBlack);
-  hist_on->SetMarkerStyle(21);
-  hist_on->SetMarkerSize(0.7);
-  hist_on->SetMarkerColor(kBlack);
-  hist_on->SetTitle("Alpha plot form -90 to 90 deg");
-  hist_off->SetTitle("Alpha plot form -90 to 90 deg");
-
-  hist_on->DrawCopy("E1P");
-  hist_off->DrawCopy("HISTSAME");
-  hist_off->DrawCopy("ESAME");
-  hist_on->DrawCopy("E1PSAME");
-
-  Double_t chialpha90 = ChiSquareNDof((TH1D*)hist_on,(TH1D*)hist_off);
-
-  x_label_pos  = alphamax*0.5;
-  y_label_pos  = hist_on->GetBinContent(hist_on->GetMaximumBin())/2.;
-
-  char text_alpha90[256];
-  sprintf(text_alpha90,"ChiSquare/NDof = %4.2f",chialpha90);
-
-  TLatex *talpha90 = new TLatex(x_label_pos, y_label_pos, text_alpha90);
-  talpha90->SetTextSize(textsize);
-//  talpha90->Draw();
-
-  gPad->Update();
-  gPad->Modified();
-
-
-  cout << "---> ChiSquare/NDof [Size] =\t\t" << chisize << endl;
-  cout << "---> ChiSquare/NDof [Dist] =\t\t" << chidist << endl;
-  cout << "---> ChiSquare/NDof [Width] =\t\t" << chiwidth << endl;
-  cout << "---> ChiSquare/NDof [Length] =\t\t" << chilength << endl;
-  cout << "---> ChiSquare/NDof [Abs(Alpha)] =\t" << chialpha << endl;
-  cout << "---> ChiSquare/NDof [Alpha] =\t\t" << chialpha90 << endl;
-
-
-  display->AddTab("SRCPOS ON");
-  TH2F *hist_srcpos_on = (TH2F*)hSrcPos_on.GetHist();
-  hist_srcpos_on->DrawCopy("BOX");
-
-  display->AddTab("SRCPOS OFF");
-  TH2F *hist_srcpos_off = (TH2F*)hSrcPos_off.GetHist();
-  hist_srcpos_off->DrawCopy("BOX");
-
-  display->AddTab("EVTNUM ON");
-  TH1F *hist_evtnum_on = (TH1F*)hDAQEvtNumber_on.GetHist();
-  hist_evtnum_on->DrawCopy();
-
-  display->AddTab("EVTNUM OFF");
-  TH1F *hist_evtnum_off = (TH1F*)hDAQEvtNumber_off.GetHist();
-  hist_evtnum_off->DrawCopy();
-
-  cout << "Done!!" <<endl;
-
-}
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/cleanComp.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/cleanComp.C	(revision 6486)
+++ 	(revision )
@@ -1,445 +1,0 @@
-/* ======================================================================== *\!
-!   Author(s): Javier Rico
-\* ======================================================================== */
-
-void cleanComp()
-{    
-  // general settings
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetOptTitle(1);
-  //  gStyle->SetTitleOffset(1.7,"y");
-  //  gStyle->SetPadLeftMargin(0.15);
-  gStyle->SetOptStat(111110);
-  gStyle->SetStatColor(0);
-  gStyle->SetStatBorderSize(1);
-  gStyle->SetStatW(0.2);
-  gStyle->SetStatH(0.1);
-  gStyle->SetStatX(0.9);
-  gStyle->SetStatY(0.9);
-  
-  // define files, chain, trees, canvas...
-  TChain* ton;
-  ton= new TChain("Events");
-  
-  // data file(s)
-  ton->Add("/local_disk/jrico/mc/cleanComp0-3.root");
-  
-  // define aliases
-  ton->SetAlias("run","MRawRunHeader.fRunNumber");
-  ton->SetAlias("event","MRawEvtHeader.fDAQEvtNumber");
-  ton->SetAlias("energy","MMcEvt.fEnergy");
-
-  // alpha0 is for the file without noise
-  // alphaNOCL is for the file with noise and no cleaning
-  ton->SetAlias("alpha0","MHillasSrc0.fAlpha");
-  ton->SetAlias("alphaNOCL","MHillasSrcnoclean.fAlpha");
-  ton->SetAlias("alpha3015","MHillasSrc3015.fAlpha");
-  ton->SetAlias("alpha4025","MHillasSrc4025.fAlpha");
-  ton->SetAlias("alpha5035","MHillasSrc5035.fAlpha");
-  ton->SetAlias("alpha6045","MHillasSrc6045.fAlpha");
-  
-  //  ton->Scan("run:event","alpha0<-30 && energy>2500 && energy<5000");
-  
-  //  plotAlphaWidth(ton);
-   plotAlphaWidthVsEnergy(ton);
-  // plotEfficiencies(ton);
-}
-
-void plotAlphaWidth(TChain* ton)
-{
-  // define and fill histos
-  const Int_t nbins=90;
-  TH1F* halpha3015 = new TH1F("Alpha3015" ,"Alpha3015",nbins,-180,180);
-  TH1F* halpha4025 = new TH1F("Alpha4025" ,"Alpha4025",nbins,-180,180);
-  TH1F* halpha5035 = new TH1F("Alpha5035" ,"Alpha5035",nbins,-180,180);
-  TH1F* halpha6045 = new TH1F("Alpha6045" ,"Alpha6045",nbins,-180,180);
-  
-  halpha3015->SetXTitle("alpha-alpha0 (deg)");
-  halpha3015->SetYTitle("Entries");
-  
-  halpha3015->SetLineColor(1);
-  halpha4025->SetLineColor(2);
-  halpha5035->SetLineColor(3);
-  halpha6045->SetLineColor(4);
-  
-  ton->Draw("alpha3015-alpha0>>Alpha3015","alpha3015!=0");
-  ton->Draw("alpha4025-alpha0>>Alpha4025","alpha4025!=0");
-  ton->Draw("alpha5035-alpha0>>Alpha5035","alpha5035!=0");
-  ton->Draw("alpha6045-alpha0>>Alpha6045","alpha6045!=0");
-  
-  // plot
-  TCanvas *c1 = new TCanvas("c1","c1",800,500);
-  c1->cd(1);
-  
-  halpha3015->Draw("HIST");
-  halpha4025->Draw("HISTSAMES");
-  halpha5035->Draw("HISTSAMES");
-  halpha6045->Draw("HISTSAMES");
-  
-  gPad->Update();
-  TPaveStats* pvstat4025  = (TPaveStats*) halpha4025->GetListOfFunctions()->FindObject("stats");
-  TPaveStats* pvstat5035  = (TPaveStats*) halpha5035->GetListOfFunctions()->FindObject("stats");
-  TPaveStats* pvstat6045  = (TPaveStats*) halpha6045->GetListOfFunctions()->FindObject("stats");
-  
-  Float_t shifty = pvstat4025->GetY2NDC()-pvstat4025->GetY1NDC();
-  
-  pvstat4025->SetY1NDC(pvstat4025->GetY1NDC()-shifty);
-  pvstat4025->SetY2NDC(pvstat4025->GetY2NDC()-shifty);
-  pvstat5035->SetY1NDC(pvstat5035->GetY1NDC()-2*shifty);
-  pvstat5035->SetY2NDC(pvstat5035->GetY2NDC()-2*shifty);
-  pvstat6045->SetY1NDC(pvstat6045->GetY1NDC()-3*shifty);
-  pvstat6045->SetY2NDC(pvstat6045->GetY2NDC()-3*shifty);
-  
-  gPad->Modified();
-  gPad->Update();
-  
-  c1->Print("cleanComp.ps");
-}
-
-/*******************************************************************************/
-void plotAlphaWidthVsEnergy(TChain* ton)
-{
-  const Int_t nbins = 8;
-  Float_t bound[nbins+1] ={0,30,50,80,150,300,600,1200,3000}; // boundary of considered size bins
-  
-  // define the arrays that will feed the graphs
-  // value of rms of the alpha-alpha0 distribution, and errors
-  Float_t alpha0[nbins];
-  Float_t alpha3015[nbins];
-  Float_t alpha4025[nbins];
-  Float_t alpha5035[nbins];
-  Float_t alpha6045[nbins];
-
-  Float_t ealpha0[nbins];
-  Float_t ealpha3015[nbins];
-  Float_t ealpha4025[nbins];
-  Float_t ealpha5035[nbins];
-  Float_t ealpha6045[nbins];
-
-  // x axis and error
-  Float_t x[nbins];
-  Float_t ex[nbins];
-
-  TH1F* hp[nbins];
-
-  // define the function that will be used to fit the histograms
-  TF1 f2("f2","[0]+[1]/[3]*exp(-(x-[2])*(x-[2])/(2*[3]*[3]))",-180.,180.);
-  f2.SetParameters(0,100,0,02);
-  f2.FixParameter(0,0);
-  f2.SetLineWidth(1);
-
-  // fill the arrays
-  for(Int_t i=0;i<nbins;i++)
-    {
-      //      cout << "Bin " << i << endl;
-      TH1F dummy0("dummy0" ,"dummy0",100,-90,90);
-      TH1F dummy3015("dummy3015" ,"dummy3015",100,-180,180);
-      TH1F dummy4025("dummy4025" ,"dummy4025",100,-180,180);
-      TH1F dummy5035("dummy5035" ,"dummy5035",100,-180,180);
-      TH1F dummy6045("dummy6045" ,"dummy6045",100,-180,180);
-
-      TH1F xdummy("xdummy" ,"xdummy",100,bound[i],bound[i+1]);
-
-      // define the cuts for each of the cleaning levels
-      char cut[100];
-      sprintf(cut,"energy>%f && energy<%f && alpha0!=0",bound[i],bound[i+1]);
-      char cut3015[200];
-      sprintf(cut3015,"%s && alpha3015!=0",cut);
-      char cut4025[200];
-      sprintf(cut4025,"%s && alpha4025!=0",cut);
-      char cut5035[200];
-      sprintf(cut5035,"%s && alpha5035!=0",cut);
-      char cut6045[200];
-      sprintf(cut6045,"%s && alpha6045!=0",cut);
-
-      TF1 f1("f1","[0]+[1]/[3]*exp(-(x-[2])*(x-[2])/(2*[3]*[3]))",-180.,180.);
-      f1.SetParameters(0,100,0,02);
-      f1.FixParameter(0,0);
-
-
-      // fill the histograms to extract later the information from rms, entries, means, etc
-      ton->Draw("alpha0>>dummy0",cut);
-      ton->Draw("alpha3015-alpha0>>dummy3015",cut3015);
-      ton->Draw("alpha4025-alpha0>>dummy4025",cut4025);
-      ton->Draw("alpha5035-alpha0>>dummy5035",cut5035);
-      ton->Draw("alpha6045-alpha0>>dummy6045",cut6045);
-
-      ton->Draw("energy>>xdummy",cut);
-
-      // fit to a gaussian and get the sigma to be plotted later
-      dummy0.Fit("f1");
-      alpha0[i]   =f1.GetParameter(3);
-      dummy3015.Fit("f1");
-      alpha3015[i]=f1.GetParameter(3);
-      dummy4025.Fit("f1");
-      alpha4025[i]=f1.GetParameter(3);
-      dummy5035.Fit("f1");
-      alpha5035[i]=f1.GetParameter(3);
-      dummy6045.Fit("f1");
-      alpha6045[i]=f1.GetParameter(3);
-
-      Float_t nevt0    = dummy0.GetEntries();
-      Float_t nevt3015 = dummy3015.GetEntries();
-      Float_t nevt4025 = dummy4025.GetEntries();
-      Float_t nevt5035 = dummy5035.GetEntries();
-      Float_t nevt6045 = dummy6045.GetEntries();
-
-      // since gaussian is not so good aproximation, compute error like follows
-      ealpha0[i]   = alpha0[i]/TMath::Sqrt(2*nevt0);
-      ealpha3015[i]= alpha3015[i]/TMath::Sqrt(2*nevt3015);
-      ealpha4025[i]= alpha4025[i]/TMath::Sqrt(2*nevt4025);
-      ealpha5035[i]= alpha5035[i]/TMath::Sqrt(2*nevt5035);
-      ealpha6045[i]= alpha6045[i]/TMath::Sqrt(2*nevt6045);
-
-      // copy some histos to be plotted later
-      Char_t nom[10];
-      sprintf(nom,"hp[%02d]",i);
-      hp[i] = new TH1F(nom,nom,100,-180,180);
-      hp[i]->GetXaxis()->SetTitle("alpha (deg)");
-      hp[i]->Add(&dummy6045);
-      hp[i]->Fit("f2");
-
-      //      cout << xdummy.GetMean() << " " << xdummy.GetRMS()<< " " << xdummy.GetEntries() << endl;
-      x[i]  = xdummy.GetMean();            
-      //      Float_t rms = xdummy.GetRMS();
-      ex[i] = 0;//rms*rms/xdummy.GetEntries();
-    }
-
-  //#if 0
-  TCanvas* cdum = new TCanvas("cdum","cdum",600,900);
-  cdum->Divide(2,nbins/2+1);
-  for(Int_t i=0;i<nbins;i++)
-    {
-      cdum->cd(i+1);
-      hp[i]->Draw();
-      gPad->Modified();
-      gPad->Update();
-    }
-  //#endif
-  
-  // create the graphs
-  TGraphErrors* gr0    = new TGraphErrors(nbins,x,alpha0,ex,ealpha0);
-  TGraphErrors* gr3015 = new TGraphErrors(nbins,x,alpha3015,ex,ealpha3015);
-  TGraphErrors* gr4025 = new TGraphErrors(nbins,x,alpha4025,ex,ealpha4025);
-  TGraphErrors* gr5035 = new TGraphErrors(nbins,x,alpha5035,ex,ealpha5035);
-  TGraphErrors* gr6045 = new TGraphErrors(nbins,x,alpha6045,ex,ealpha6045);  
-
-  // marker/line colors
-  gr0->SetMarkerStyle(20);
-  gr3015->SetMarkerStyle(24);
-  gr4025->SetMarkerStyle(21);
-  gr5035->SetMarkerStyle(25);
-  gr6045->SetMarkerStyle(22);
-
-  gr0->SetMarkerColor(1);
-  gr3015->SetMarkerColor(2);
-  gr4025->SetMarkerColor(3);
-  gr5035->SetMarkerColor(4);
-  gr6045->SetMarkerColor(6);
-
-  gr0->SetLineColor(1);
-  gr3015->SetLineColor(2);
-  gr4025->SetLineColor(3);
-  gr5035->SetLineColor(4);
-  gr6045->SetLineColor(6);
-
-  //////////////////////
-  // plot alpha width //
-  //////////////////////
-  TCanvas *c1 = new TCanvas("c1","c1",800,500);
-  c1->cd(1);
-  gPad->SetGridx();  
-  gPad->SetGridy();  
-  gPad->SetLogx();
-
-  TGraphErrors* grfirst = gr4025;
-  grfirst->Draw("APL");
-  gr0->Draw("PL");
-  gr3015->Draw("PL");
-  gr4025->Draw("PL");
-  gr5035->Draw("PL");
-  gr6045->Draw("PL");
-
-  grfirst->GetHistogram()->SetTitle("Cleaning comparison (alpha)");
-  grfirst->GetHistogram()->GetXaxis()->SetTitle("E_{MC} [GeV]");
-  grfirst->GetHistogram()->GetYaxis()->SetTitle("#sigma (alpha-alpha_{0}) [deg]");
-  grfirst->GetHistogram()->SetMaximum(80);
-
-  TPaveLabel* label = new TPaveLabel(0.25,0.75,0.6,0.85,"MC Gammas - zbins 0-3","NDC");
-  label->SetBorderSize(0);
-  label->SetFillColor(0);
-  label->Draw();
-
-  // legend
-  TLegend* leg = new TLegend(.6,.5,.8,.8);
-  leg->SetHeader("");
-  leg->SetFillColor(0);
-  leg->SetLineColor(0);
-  leg->SetBorderSize(0);
-  leg->AddEntry(gr0,"No noise","p");
-  leg->AddEntry(gr3015,"(3.0,1.5)","p");
-  leg->AddEntry(gr4025,"(4.0,2.5)","p");
-  leg->AddEntry(gr5035,"(5.0,3.5)","p");
-  leg->AddEntry(gr6045,"(6.0,4.5)","p");
-  leg->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-  // print to file
-  c1->Print("cleanAlphaWidthVSEnergy.ps");
-}
-
-/*******************************************************************************/
-void plotEfficiencies(TChain* ton)
-{
-  const Int_t nbins = 8;
-  Float_t bound[nbins+1] ={0,30,50,80,150,300,600,1200,3000}; // boundary of considered size bins
-  
-  // define the arrays that will feed the graphs
-  // gamma detection efficiency, and errors  
-  Float_t effNOCL[nbins];
-  Float_t eff3015[nbins];
-  Float_t eff4025[nbins];
-  Float_t eff5035[nbins];
-  Float_t eff6045[nbins];
-
-  Float_t eeffNOCL[nbins];
-  Float_t eeff3015[nbins];
-  Float_t eeff4025[nbins];
-  Float_t eeff5035[nbins];
-  Float_t eeff6045[nbins];
-
-  // x axis and error
-  Float_t x[nbins];
-  Float_t ex[nbins];
-
-  // fill the arrays
-  for(Int_t i=0;i<nbins;i++)
-    {
-      //      cout << "Bin " << i << endl;
-      TH1F dummyNOCL("dummyNOCL" ,"dummyNOCL",100,-90,90);
-      TH1F dummy3015("dummy3015" ,"dummy3015",100,-90,90);
-      TH1F dummy4025("dummy4025" ,"dummy4025",100,-90,90);
-      TH1F dummy5035("dummy5035" ,"dummy5035",100,-90,90);
-      TH1F dummy6045("dummy6045" ,"dummy6045",100,-90,90);
-
-      TH1F xdummy("xdummy" ,"xdummy",100,bound[i],bound[i+1]);
-
-      // define the cuts for each of the cleaning levels
-      char cut[100];
-      sprintf(cut,"energy>%f && energy<%f && alpha0!=0",bound[i],bound[i+1]);
-      char cutNOCL[200];
-      sprintf(cutNOCL,"%s && alphaNOCL!=0",cut);
-      char cut3015[200];
-      sprintf(cut3015,"%s && alpha3015!=0",cut);
-      char cut4025[200];
-      sprintf(cut4025,"%s && alpha4025!=0",cut);
-      char cut5035[200];
-      sprintf(cut5035,"%s && alpha5035!=0",cut);
-      char cut6045[200];
-      sprintf(cut6045,"%s && alpha6045!=0",cut);
-
-
-      // fill the histograms to extract later the information from rms, entries, means, etc
-      ton->Draw("alpha0>>dummyNOCL",cutNOCL);
-      ton->Draw("alpha0>>dummy3015",cut3015);
-      ton->Draw("alpha0>>dummy4025",cut4025);
-      ton->Draw("alpha0>>dummy5035",cut5035);
-      ton->Draw("alpha0>>dummy6045",cut6045);
-
-      ton->Draw("energy>>xdummy",cut);
-
-      Float_t nevt0    = dummyNOCL.GetEntries();
-      Float_t nevt3015 = dummy3015.GetEntries();
-      Float_t nevt4025 = dummy4025.GetEntries();
-      Float_t nevt5035 = dummy5035.GetEntries();
-      Float_t nevt6045 = dummy6045.GetEntries();
-
-      // fill the array of efficiencies
-      eff3015[i] = nevt3015/nevt0*100;
-      eff4025[i] = nevt4025/nevt0*100;
-      eff5035[i] = nevt5035/nevt0*100;
-      eff6045[i] = nevt6045/nevt0*100;
-
-      eeff3015[i] = TMath::Sqrt(nevt3015)/nevt0*100;
-      eeff4025[i] = TMath::Sqrt(nevt4025)/nevt0*100;
-      eeff5035[i] = TMath::Sqrt(nevt5035)/nevt0*100;
-      eeff6045[i] = TMath::Sqrt(nevt6045)/nevt0*100;
-
-      //      cout << xdummy.GetMean() << " " << xdummy.GetRMS()<< " " << xdummy.GetEntries() << endl;
-      x[i]  = xdummy.GetMean();            
-      //      Float_t rms = xdummy.GetRMS();
-      ex[i] = 0;//rms*rms/xdummy.GetEntries();
-    }
-
-  // create the graphs
-  TGraphErrors* efgr3015 = new TGraphErrors(nbins,x,eff3015,ex,eeff3015);
-  TGraphErrors* efgr4025 = new TGraphErrors(nbins,x,eff4025,ex,eeff4025);
-  TGraphErrors* efgr5035 = new TGraphErrors(nbins,x,eff5035,ex,eeff5035);
-  TGraphErrors* efgr6045 = new TGraphErrors(nbins,x,eff6045,ex,eeff6045);  
-
-  // marker/line colors
-  efgr3015->SetMarkerStyle(24);
-  efgr4025->SetMarkerStyle(21);
-  efgr5035->SetMarkerStyle(25);
-  efgr6045->SetMarkerStyle(22);
-
-  efgr3015->SetMarkerColor(2);
-  efgr4025->SetMarkerColor(3);
-  efgr5035->SetMarkerColor(4);
-  efgr6045->SetMarkerColor(6);
-
-  efgr3015->SetLineColor(2);
-  efgr4025->SetLineColor(3);
-  efgr5035->SetLineColor(4);
-  efgr6045->SetLineColor(6);
-
-  ///////////////////////
-  // plot efficiencies //
-  ///////////////////////
-  TCanvas *c1 = new TCanvas("c1","c1",800,500);
-  c1->cd(1);
-  gPad->SetGridx();  
-  gPad->SetGridy();  
-  gPad->SetLogx();
-
-  TGraphErrors* efgrfirst = efgr6045;
-  efgrfirst->Draw("APL");
-  efgr3015->Draw("PL");
-  efgr4025->Draw("PL");
-  efgr5035->Draw("PL");
-  efgr6045->Draw("PL");
-
-  efgrfirst->GetHistogram()->SetTitle("Cleaning comparison (efficiency)");
-  efgrfirst->GetHistogram()->GetXaxis()->SetTitle("E_{MC} [GeV]");
-  efgrfirst->GetHistogram()->GetYaxis()->SetTitle("Detection efficiency (%)");
-
-  // label
-  TPaveLabel* eflabel = new TPaveLabel(0.5,0.49,0.85,0.59,"MC Gammas - zbins 0-3","NDC");
-  eflabel->SetBorderSize(0);
-  eflabel->SetFillColor(0);
-  eflabel->Draw();
- 
-  // legend
-  TLegend* efleg = new TLegend(.6,.2,.8,.5);
-  efleg->SetHeader("");
-  efleg->SetFillColor(0);
-  efleg->SetLineColor(0);
-  efleg->SetBorderSize(0);
-  efleg->AddEntry(efgr3015,"(3.0,1.5)","p");
-  efleg->AddEntry(efgr4025,"(4.0,2.5)","p");
-  efleg->AddEntry(efgr5035,"(5.0,3.5)","p");
-  efleg->AddEntry(efgr6045,"(6.0,4.5)","p");
-  efleg->Draw();
-
-  gPad->Modified();
-  gPad->Update();
-
-  // print to file
-  c1->Print("cleanEfficiency.ps");
-}
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/computeCoeff.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/computeCoeff.C	(revision 6486)
+++ 	(revision )
@@ -1,61 +1,0 @@
-
-
-void computeCoeff()
-{    
-  MEffAreaAndCoeffCalc calc;
-  calc.AddFile("/data/star_gamma_test.root");
-
-  /************************************************/
-  /* Build spectrum                               */
-  /* now it's just a cross check with the same MC */
-  /************************************************/
-  const Int_t ebins = 20;              // number of bins to build spectrum
-  const Double_t emin=10;
-  const Double_t emax=200;
-  const Int_t tbins = 2;
-  const Double_t thetab[tbins+1] = {0,10,20};
-  calc.SetEbins(ebins);
-  calc.SetEmin(emin);
-  calc.SetEmax(emax);
-  calc.SetThetaBinning(tbins,thetab);
-  
-  // define the funtion of the desired spectrum
-  calc.SetFunction("4.e9*pow(x,-2.6+1)");
-  calc.ComputeAllFactors();
-  
-  const UInt_t ncutfiles=1;
-  Char_t* cutName[ncutfiles]={"/data/star_gamma_test.root"};
-
-  TChain* ccut = new TChain("Events");
-  for(Int_t i = 0; i < ncutfiles; i++)
-    ccut->Add(cutName[i]);
-  ccut->SetAlias("logestenergy","log10(MHillas.fSize/0.18/15.)");
-  ccut->SetAlias("theta","MMcEvt.fTelescopeTheta*180./3.14159");
-
-
-  const Double_t logemin = TMath::Log10(emin);
-  const Double_t logemax = TMath::Log10(emax);
-  TH1D* hspec = new TH1D("hspec","Spectrum",ebins,logemin,logemax);
-  hspec->Sumw2();
-  ccut->Draw("logestenergy>>hspec","theta<10","goff");
-
-  for(Int_t i=0;i<ebins;i++)
-    {
-      const Float_t uncorrval = hspec->GetBinContent(i+1);
-      const Float_t effa  =  calc.GetEffectiveAreaHisto()->GetBinContent(i+1,1);
-      const Float_t unfold = calc.GetCoefficientHisto()->GetBinContent(i+1,1);
-      Float_t corrval;
-      if(effa)
-	corrval = uncorrval*unfold/effa*1e9;
-      else
-	corrval = 0;
-      hspec->SetBinContent(i+1,corrval);
-    }
-
-  // SAVE RESULTS
-  TFile file("prueba.root","RECREATE");
-  hspec->Write();
-  calc.GetEffectiveAreaHisto()->Write();
-  calc.GetCoefficientHisto()->Write();
-  return;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/distancebetweenstars.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/distancebetweenstars.C	(revision 6486)
+++ 	(revision )
@@ -1,249 +1,0 @@
- /* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier López, 05/2004 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-Bool_t HandleInput()
-{
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-Double_t fitfunc(Double_t *x, Double_t *par);
-
-void distancebetweenstars(const TString filename="dc_2004_03_17_01_16_51_20440_Mrk421.root", const TString directory="/nfs/magic/CaCodata/rootdata/Mrk421/Period015/2004_03_17/", const UInt_t numEvents = 100000000)
-{
-
-    // general settings
-    gROOT->Reset();
-    gStyle->SetCanvasColor(0);
-    gStyle->SetCanvasBorderMode(0);
-    gStyle->SetPadBorderMode(0);
-    gStyle->SetFrameBorderMode(0);
-    gStyle->SetOptTitle(0);
-    gStyle->SetTitleOffset(1.7,"y");
-    gStyle->SetPadLeftMargin(0.15);
-    gStyle->SetOptStat(111110);
-    gStyle->SetOptFit(1);
-    gStyle->SetStatColor(0);
-    gStyle->SetStatBorderSize(1);
-    gStyle->SetStatW(0.2);
-    gStyle->SetStatH(0.1);
-    gStyle->SetStatX(0.9);
-    gStyle->SetStatY(0.9);
-
-  Int_t nbins  = 100;
-  Float_t mindist = 0.0;
-  Float_t maxdist = 400.0;
-  
-  TH1F* histStarsDintances = new TH1F("StarsDintances","Distance between stars",nbins,mindist,maxdist);
-  histStarsDintances->SetXTitle("Distance [mm]");
-  histStarsDintances->SetYTitle("Counts [#]");
-  TH1F* histStarsDintances1 = new TH1F("StarsDintances1","Distance between stars",nbins,mindist,maxdist);
-  TH1F* histStarsDintances2 = new TH1F("StarsDintances2","Distance between stars [1]-[3]",nbins,mindist,maxdist);
-  TH1F* histStarsDintances3 = new TH1F("StarsDintances3","Distance between stars [2]-[3]",nbins,mindist,maxdist);
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-  MGeomCamMagic geomcam;
-  MCameraDC     dccam;
-  MStarLocalCam starcam;
-
-  plist.AddToList(&geomcam);
-  plist.AddToList(&dccam);
-  plist.AddToList(&starcam);
-
-  //
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-
-  // Reads the trees of the root file and the analysed branches
-  MReadReports read;
-  read.AddTree("Currents"); 
-  read.AddFile(directory+filename);     // after the reading of the trees!!!
-  read.AddToBranchList("MReportCurrents.*");
-
-  MGeomApply geomapl;
-  TString continuoslightfile = 
-    //    "/home/Javi/mnt_magic_data/CaCo/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
-        "/nfs/magic/CaCodata/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
-
-  Float_t mindc = 0.7;
-  MCalibrateDC dccal;
-  dccal.SetFileName(continuoslightfile);
-  dccal.SetMinDCAllowed(mindc);
-
-  const Int_t numblind = 5;
-  const Short_t x[numblind] = { 47, 124, 470, 475, 571};
-  const TArrayS blindpixels(numblind,(Short_t*)x);
-  Float_t ringinterest = 100; //[mm]
-  Float_t tailcut = 4.0;
-  UInt_t integratedevents = 1;
-
-  MFindStars findstars;
-  findstars.SetBlindPixels(blindpixels);
-  findstars.SetRingInterest(ringinterest);
-  findstars.SetDCTailCut(tailcut);
-  findstars.SetNumIntegratedEvents(integratedevents);
-  findstars.SetMinuitPrintOutLevel(-1);
-
-  tlist.AddToList(&geomapl);
-  tlist.AddToList(&read);
-  tlist.AddToList(&dccal);
-  tlist.AddToList(&findstars, "Currents");
-
-  //
-  // Create and setup the eventloop
-  //
-  MEvtLoop evtloop;
-  evtloop.SetParList(&plist);
-  
-//   MProgressBar bar;
-//   evtloop.SetProgressBar(&bar);
-  
-  //
-  // Execute your analysis
-  //
-  
-//   if (!evtloop.Eventloop(numEvents))
-//     return;
-
-  if (!evtloop.PreProcess())
-    return;
-
-  Float_t maxchindof = 4.;
-  
-  while (tlist.Process())
-    {
-  
-      Int_t numStars = starcam.GetNumStars();
-      if ( numStars == 3)
-        {
-          
-          for (Int_t first=0; first<numStars; first++)
-            {
-              if (starcam[first].GetChiSquareNdof()>0. && starcam[first].GetChiSquareNdof()<maxchindof)
-                {
-                  for (Int_t second=first+1; second<numStars; second++)
-                    {
-                      if (starcam[second].GetChiSquareNdof()>0. && starcam[second].GetChiSquareNdof()<maxchindof)
-                        {
-                          Float_t dist = TMath::Sqrt((starcam[first].GetMeanX()-starcam[second].GetMeanX())*
-                                                     (starcam[first].GetMeanX()-starcam[second].GetMeanX()) +
-                                                     (starcam[first].GetMeanY()-starcam[second].GetMeanY())*
-                                                     (starcam[first].GetMeanY()-starcam[second].GetMeanY()));
-
-                            histStarsDintances->Fill(dist);
-                          if (first == 0 && second == 1)
-                            histStarsDintances1->Fill(dist);
-                          else if (first == 0 && second == 2)
-                            histStarsDintances2->Fill(dist);
-                          else if (first == 1 && second == 2)
-                            histStarsDintances3->Fill(dist);
-
-                        }
-                    }
-                }
-            }
-        }
-    }
-  
-  
-
-  evtloop.PostProcess();
-
-  tlist.PrintStatistics();
-
-  //Draw results
-
-  //   histStarsDintances->Draw();
-
-// Creates a Root function based on function fitf above
-   TF1 *func = new TF1("fitfunc",fitfunc,mindist,maxdist,7);
-
-// Sets initial values and parameter names
-   func->SetParNames("ConvF","Max0","Sig0","Max1","Sig1","Max2","Sig2");
-   func->SetParameters(300.,500.,5.,500.,5.,500.,5.);
-
-// Fit histogram in range defined by function
-   histStarsDintances->Fit("fitfunc","R");
-
-//   histStarsDintances1->Draw();
-//   histStarsDintances2->Fit("gaus","0");
-//   histStarsDintances2->Draw("same");
-//   histStarsDintances2->Fit("gaus","0");
-//   histStarsDintances3->Draw("same");
-//   histStarsDintances3->Fit("gaus","0");
-
-  if (!HandleInput())
-
-  delete histStarsDintances;
-  delete histStarsDintances1;
-  delete histStarsDintances2;
-  delete histStarsDintances3;
-  
-}
-
-Double_t fitfunc(Double_t *x, Double_t *par)
-{
-  Double_t dist[3] = 
-    {
-      0.64,0.750,1.203
-    };
-  
-  
-   Double_t fitval = 
-     par[1]*TMath::Exp(-0.5*(x[0]-par[0]*dist[0])*(x[0]-par[0]*dist[0])/(par[2]*par[2])) +
-     par[3]*TMath::Exp(-0.5*(x[0]-par[0]*dist[1])*(x[0]-par[0]*dist[1])/(par[4]*par[4])) +
-     par[5]*TMath::Exp(-0.5*(x[0]-par[0]*dist[2])*(x[0]-par[0]*dist[2])/(par[6]*par[6]));
-
-   //   cout << "x "  << x[0] << " fitval " << fitval << endl;
-   
-
-   return fitval;
-}
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/findstars.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/findstars.C	(revision 6486)
+++ 	(revision )
@@ -1,175 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier López, 05/2004 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-
-Bool_t HandleInput()
-{
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-
-void findstars(const TString filename="20040422_*_D_Mrk421_E.root", const TString directory="/local_disk/Data/rootdata/Mrk421/Period016/2004_04_22/", const UInt_t numEvents = 0)
-{
-
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-
-  MGeomCamMagic geomcam;
-  MCameraDC     dccam;
-  MStarLocalCam starcam;
-
-  plist.AddToList(&geomcam);
-  plist.AddToList(&dccam);
-  plist.AddToList(&starcam);
-
-  //
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-
-  // Reads the trees of the root file and the analysed branches
-  MReadReports read;
-  read.AddTree("Currents"); 
-  read.AddFile(directory+filename);     // after the reading of the trees!!!
-  read.AddToBranchList("MReportCurrents.*");
-
-  MGeomApply geomapl;
-  TString continuoslightfile = 
-    "/local_disk/CaCoData/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
-
-  Float_t mindc = 0.9; //[uA]
-  MCalibrateDC dccal;
-  dccal.SetFileName(continuoslightfile);
-  dccal.SetMinDCAllowed(mindc);
-
-  const Int_t numblind = 5;
-  const Short_t x[numblind] = { 47, 124, 470, 475, 571};
-  const TArrayS blindpixels(numblind,(Short_t*)x);
-  Float_t ringinterest = 100; //[mm]
-  Float_t tailcut = 3.5;
-  UInt_t integratedevents = 4;
-
-  MFindStars findstars;
-  findstars.SetBlindPixels(blindpixels);
-  findstars.SetRingInterest(ringinterest);
-  findstars.SetDCTailCut(tailcut);
-  findstars.SetNumIntegratedEvents(integratedevents);
-  findstars.SetMinuitPrintOutLevel(-1);
-
-  
-  tlist.AddToList(&geomapl);
-  tlist.AddToList(&read);
-  tlist.AddToList(&dccal);
-  tlist.AddToList(&findstars, "Currents");
-
-  //
-  // Create and setup the eventloop
-  //
-  MEvtLoop evtloop;
-  evtloop.SetParList(&plist);
-     
-  //
-  // Execute your analysis
-  //
-
-  if (numEvents > 0)
-  {
-      if (!evtloop.Eventloop(numEvents))
-	  return;
-  }
-  else
-  {
-      if (!evtloop.PreProcess())
-	  return;
-      
-//        MHCamera display0(geomcam);
-//        display0.SetPrettyPalette();
-//        display0.Draw();
-//        //       display0.SetCamContent(dccal.GetDisplay());
-//        display0.SetCamContent(dccal.GetDCCalibrationFactor());
-//        gPad->Modified();
-//        gPad->Update();
-
-//        // Remove the comments if you want to go through the file
-//        // event-by-event:
-//        if (!HandleInput())
-//          break;
-
-       MHCamera display(geomcam);
-       display.SetPrettyPalette();
-       display.Draw();
-       gPad->cd(1);
-       starcam.Draw();
-      
-       UInt_t numevents=0;
-       
-       while (tlist.Process())
-         {
-           numevents++;
-           if (numevents%integratedevents==0)
-             {
-               //               display.SetCamContent(dccam);
-               display.SetCamContent(findstars.GetDisplay());
-               gPad->Modified();
-               gPad->Update();
-               starcam.Print("maxpossizechi");
-               // Remove the comments if you want to go through the file
-               // event-by-event:
-               if (!HandleInput())
-                 break;
-             }
-      } 
-
-      evtloop.PostProcess();
-  }
-
-  tlist.PrintStatistics();
-
-}
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/hillasONOFF.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/hillasONOFF.C	(revision 6486)
+++ 	(revision )
@@ -1,1339 +1,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-//           _____Macro for checking the hillas parameters_____
-//
-//                       Ester Aliu  <aliu@ifae.es>
-////////////////////////////////////////////////////////////////////////////
-void hillasONOFF()
-{    
-    // general settings
-    gROOT->Reset();
-    gStyle->SetCanvasColor(0);
-    gStyle->SetCanvasBorderMode(0);
-    gStyle->SetPadBorderMode(0);
-    gStyle->SetFrameBorderMode(0);
-    gStyle->SetOptStat(kFALSE);
-    // gStyle->SetTitleSize(0);
-    gStyle->SetStatColor(0);
-    gStyle->SetStatBorderSize(1);
-    gStyle->SetStatW(0.2);
-    gStyle->SetStatH(0.1);
-    gStyle->SetStatX(0.9);
-    gStyle->SetStatY(0.9);
- 
-       
-    // define file, tree, canvas
-    TChain* t= new TChain("Parameters");
-    //    t->AddFile("/local_disk/jrico/hillas/hillasOn21.root");
-    //    t->AddFile("/local_disk/jrico/hillas/hillasOn22.root");
-    t->AddFile("/local_disk/jrico/hillas/RFOnnoAlpha.root");
-    
-    // define file, tree, canvas
-    TChain *t2 = new TChain("Parameters");
-    //    t2->AddFile("/local_disk/jrico/hillas/hillasOff09.root");
-    //    t2->AddFile("/local_disk/jrico/hillas/hillasOff18.root");
-    //    t2->AddFile("/local_disk/jrico/hillas/hillasOff21.root");
-    t2->AddFile("/local_disk/jrico/hillas/RFOffnoAlpha.root");
-
-   
-    TString psname="hillasonoff.ps";
-    TString title;
-
-    TH1F* hLength; 
-    TH1F* hWidth; 
-    TH1F* hDist;
-    TH1F* hConc;
-    TH1F* hConc1;
-    TH1F* hConc6;
-    TH1F* hAlpha; 
-    TH1F* hSize; 
-
-    TH2F *hXY;
-
-    // define aliases
-    t->SetAlias("length","MHillas.fLength*0.6/189");
-    t->SetAlias("width","MHillas.fWidth*0.6/189");
-    t->SetAlias("dist","MHillasSrc.fDist*0.6/189");
-    t->SetAlias("conc","MNewImagePar.fConc");
-    t->SetAlias("conc1","MNewImagePar.fConc1");
-    t->SetAlias("conc6","MConcentration.fConc[6]");
-    t->SetAlias("size","MHillas.fSize");
-    t->SetAlias("alpha","abs(MHillasSrc.fAlpha)");
-    t->SetAlias("meanx","MHillas.fMeanX");
-    t->SetAlias("meany","MHillas.fMeanY");
-
-    // define aliases
-    t2->SetAlias("length","MHillas.fLength*0.6/189");
-    t2->SetAlias("width","MHillas.fWidth*0.6/189");
-    t2->SetAlias("dist","MHillasSrc.fDist*0.6/189");
-    t2->SetAlias("conc","MNewImagePar.fConc");
-    t2->SetAlias("conc1","MNewImagePar.fConc1");
-    t2->SetAlias("conc6","MConcentration.fConc[6]");
-    t2->SetAlias("size","MHillas.fSize");
-    t2->SetAlias("alpha","abs(MHillasSrc.fAlpha)");
-    t2->SetAlias("meanx","MHillas.fMeanX");
-    t2->SetAlias("meany","MHillas.fMeanY");
-
-      
-    // define  cuts
-    const char* cut1 = "size>500 && MHadronness.fHadronness<0.1";
-    const char* cut2 = "size>1000";
-    const char* cut3 = "size>2000";
-    const char* cut4 = "size>5000";
-    const char* cut5 = "size>10000";
-
-    const char* cutDist = "MHillasSrc.fDist*0.6/189.>0.2 && MHillasSrc.fDist*0.6/189.<0.8";
-
-
-    /*****************************************************************
-    ****                         PLOTS                            ****
-    *****************************************************************/
-    
-    Int_t nbin;
-    Float_t min;
-    Float_t max;
-
-
-    TString openpsname;
-    openpsname = psname + "(";
-
-    TString closepsname;
-    closepsname = psname  + ")";
-
-
-    //////////////////////////////////////////////////////////////
-    //                    Cuts in Size
-    //////////////////////////////////////////////////////////////
-    TCanvas *c1 = new TCanvas("c1","c1",500,800);
-    c1->Divide(2,3);
-    /////////////////////////////////////////////////////////////////
-
-    char* var="length>>hLength";    
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c1->cd(1);
-    c1->GetPad(1)->SetGrid();    
-    title = "length " ;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var, "","goff");  
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-    
-    c1->cd(2);
-    c1->GetPad(2)->SetGrid();    
-    title = "length ";  
-    title = title + cut1;
-    hLength = new TH1F("hLength",title, nbin, min, max);
-    t->Draw(var,cut1,"goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");    
-    c1->GetPad(2)->Update();
-  
-    c1->cd(3);
-    c1->GetPad(3)->SetGrid();    
-    title = "length ";  
-    title = title + cut2;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cut2,"goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(3)->Update();
-  
-    c1->cd(4);
-    c1->GetPad(4)->SetGrid();    
-    title = "length ";  
-    title = title + cut3;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cut3, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(4)->Update();
-        
-    c1->cd(5);
-    c1->GetPad(5)->SetGrid();    
-    title = "length ";  
-    title = title + cut4;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cut4, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(5)->Update();
-        
-    c1->cd(6);
-    c1->GetPad(6)->SetGrid();    
-    title = "length ";  
-    title = title + cut5;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cut5, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1.);
-    hLength->Draw("Ehist");
-    c1->GetPad(6)->Update();
-   
-    //off data
-
-    c1->cd(1);
-    title = "length " ;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var, "","goff");  
-    hLength->SetXTitle("degrees");
-    //hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-    
-    c1->cd(2);
-    title = "length ";  
-    title = title + cut1;
-    hLength = new TH1F("hLength",title, nbin, min, max);
-    t2->Draw(var,cut1,"goff");
-    hLength->SetXTitle("degrees");
-    //hLength->SetLineStyle(2);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetMarkerStyle(20);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");    
-    c1->GetPad(2)->Modified();    
-    c1->GetPad(2)->Update();
-  
-    c1->cd(3);
-    title = "length ";  
-    title = title + cut2;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cut2,"goff");
-    //hLength->SetXTitle("degrees");
-    hLength->SetMarkerSize(0.4);
-    hLength->SetMarkerStyle(20);
-    //hLength->SetLineStyle(2);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-  
-    c1->cd(4);
-    title = "length ";  
-    title = title + cut3;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cut3, "goff");
-    hLength->SetXTitle("degrees");
-    //    hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-        
-    c1->cd(5);
-    title = "length ";  
-    title = title + cut4;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cut4, "goff");
-    hLength->SetXTitle("degrees");
-    //hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-        
-    c1->cd(6);
-    title = "length ";  
-    title = title + cut5;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cut5, "goff");
-    hLength->SetXTitle("degrees");
-    // hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-    
-    c1->Print(openpsname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="width>>hWidth";
-
-    nbin = 40; min = 0.; max = 0.8;
-
-    c1->cd(1);
-    title = "width ";  
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "width ";  
-    title = title + cut1;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut1, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "width ";  
-    title = title + cut2;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut2, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "width ";  
-    title = title + cut3;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut3, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "width ";  
-    title = title + cut4;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut4, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "width ";  
-    title = title + cut5;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cut5, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1.);
-    hWidth->Draw("Ehist");
-    c1->GetPad(6)->Update();
-
-    // offdata
-   
-    c1->cd(1);
-    title = "width ";  
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "width ";  
-    title = title + cut1;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut1, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");    
-    c1->GetPad(2)->Modified();    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "width ";  
-    title = title + cut2;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut2, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "width ";  
-    title = title + cut3;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut3, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "width ";  
-    title = title + cut4;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut4, "goff");
-    hWidth->SetXTitle("degrees");
-    // hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "width ";  
-    title = title + cut5;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cut5, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-
-   
-    c1->Print(psname); 
- 
-    /////////////////////////////////////////////////////////////////
-
-    char* var="dist>>hDist";
-      
-    nbin = 40; min = 0.; max = 1.6;
-
-    c1->cd(1);
-    title = "dist ";  
-    hDist = new TH1F("hDist",title,nbin, min, max);   
-    t->Draw(var, "", "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "dist ";  
-    title = title + cut1;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut1, "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "dist ";  
-    title = title + cut2;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut2, "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "dist ";  
-    title = title + cut3;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut3, "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "dist ";  
-    title = title + cut4;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut4, "goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "dist ";  
-    title = title + cut5;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t->Draw(var,cut5,"goff");
-    hDist->SetXTitle("degrees");
-    hDist->SetNormFactor(1.);
-    hDist->Draw("Ehist");
-    c1->GetPad(6)->Update();
-
-    //offdata
-
-    c1->cd(1);
-    title = "dist ";  
-    hDist = new TH1F("hDist",title,nbin, min, max);   
-    t2->Draw(var, "", "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "dist ";  
-    title = title + cut1;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut1, "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");    
-    c1->GetPad(2)->Modified();    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "dist ";  
-    title = title + cut2;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut2, "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);   
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "dist ";  
-    title = title + cut3;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut3, "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "dist ";  
-    title = title + cut4;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut4, "goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "dist ";  
-    title = title + cut5;
-    hDist = new TH1F("hDist",title,nbin, min, max);
-    t2->Draw(var,cut5,"goff");
-    hDist->SetXTitle("degrees");
-    //hDist->SetLineStyle(2);
-    hDist->SetMarkerStyle(20);
-    hDist->SetMarkerSize(0.4);
-    hDist->SetNormFactor(1);
-    hDist->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-
-    c1->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="conc>>hConc";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c1->cd(1);
-    title = "conc ";  
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,"","goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "conc ";  
-    title = title + cut1;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut1,"goff");    
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "conc ";  
-    title = title + cut2;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut2,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "conc ";  
-    title = title + cut3;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut3,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "conc ";  
-    title = title + cut4;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut4,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "conc ";  
-    title = title + cut5;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cut5,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c1->GetPad(6)->Update();
-  
-    //offdata 
-
-    c1->cd(1);
-    title = "conc ";  
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var, "","goff");
-    hConc->SetNormFactor(1.);
-    //hConc->SetLineStyle(2);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    hConc->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "conc ";  
-    title = title + cut1;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut1,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    // hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(2)->Modified();        
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "conc ";  
-    title = title + cut2;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut2,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    //hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "conc ";  
-    title = title + cut3;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut3,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    //hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "conc ";  
-    title = title + cut4;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut4,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    //hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "conc ";  
-    title = title + cut5;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cut5,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    //hConc->SetLineStyle(2);
-    hConc->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-  
-    c1->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="conc6>>hConc6";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c1->cd(1);
-    title = "conc6 ";  
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,"","goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "conc6 ";  
-    title = title + cut1;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut1,"goff");  
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");  
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "conc6 ";  
-    title = title + cut2;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut2,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "conc6 ";  
-    title = title + cut3;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut3,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "conc6 ";  
-    title = title + cut4;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut4,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "conc6 ";  
-    title = title + cut5;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cut5,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c1->GetPad(6)->Update();
-
-    //offdata
-
-    c1->cd(1);
-    title = "conc6 ";  
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,"","goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "conc6 ";  
-    title = title + cut1;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut1,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(2)->Modified();        
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "conc6 ";  
-    title = title + cut2;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut2,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "conc6 ";  
-    title = title + cut3;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut3,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "conc6 ";  
-    title = title + cut4;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut4,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    // hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "conc6 ";  
-    title = title + cut5;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cut5,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    //hConc6->SetLineStyle(2);
-    hConc6->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-
-    c1->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="alpha>>hAlpha";
-
-    nbin = 18; min = 0.; max = 90.;
-    
-    c1->cd(1);
-    title = "alpha ";  
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "alpha ";  
-    title = title + cut1;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut1, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "alpha ";  
-    title = title + cut2;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut2, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "alpha ";  
-    title = title + cut3;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut3, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "alpha ";  
-    title = title + cut4;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut4, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "alpha ";  
-    title = title + cut5;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cut5, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c1->GetPad(6)->Update();
-
-    //offdata
-
-    c1->cd(1);
-    title = "alpha ";  
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetNormFactor(1);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->Draw("samePE");
-    c1->GetPad(1)->Modified();    
-    c1->GetPad(1)->Update();    
-
-    c1->cd(2);
-    title = "alpha ";  
-    title = title + cut1;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut1, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");    
-    c1->GetPad(2)->Modified();    
-    c1->GetPad(2)->Update();
-    
-    c1->cd(3);
-    title = "alpha ";  
-    title = title + cut2;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut2, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetNormFactor(1);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->Draw("samePE");
-    c1->GetPad(3)->Modified();    
-    c1->GetPad(3)->Update();
-    
-    c1->cd(4);
-    title = "alpha ";  
-    title = title + cut3;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut3, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c1->GetPad(4)->Modified();    
-    c1->GetPad(4)->Update();
-    
-    c1->cd(5);
-    title = "alpha ";  
-    title = title + cut4;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut4, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c1->GetPad(5)->Modified();    
-    c1->GetPad(5)->Update();
-    
-    c1->cd(6);
-    title = "alpha ";  
-    title = title + cut5;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cut5, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c1->GetPad(6)->Modified();    
-    c1->GetPad(6)->Update();
-
-    c1->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    //                     Cuts in Dist
-    /////////////////////////////////////////////////////////////////
-
-    TCanvas *c2 = new TCanvas("c2","Cuts in Dist",500,800);
-    c2->Divide(2,3);
-    /////////////////////////////////////////////////////////////////
-    char* var="length>>hLength";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c2->cd(1);
-    //    c2->GetPad(1)->SetGrid();    
-    title = "length "; 
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1);
-    hLength->Draw("Ehist");
-    c2->GetPad(1)->Update();
- 
-    c2->cd(2);
-    //c2->GetPad(2)->SetGrid();    
-    title = "length ";  
-    title = title + cutDist;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t->Draw(var,cutDist, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetNormFactor(1);
-    hLength->Draw("Ehist");
-    c2->GetPad(2)->Update();
-
-    //offdata
-        
-    c2->cd(1);
-    c2->GetPad(1)->SetGrid();    
-    title = "length "; 
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hLength->SetXTitle("degrees");
-    //   hLength->SetLineStyle(2);
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c2->GetPad(1)->Modified();    
-    c2->GetPad(1)->Update();
- 
-    c2->cd(2);
-    c2->GetPad(2)->SetGrid();    
-    title = "length ";  
-    title = title + cutDist;
-    hLength = new TH1F("hLength",title,nbin, min, max);
-    t2->Draw(var,cutDist, "goff");
-    hLength->SetXTitle("degrees");
-    hLength->SetMarkerStyle(20);
-    hLength->SetMarkerSize(0.4);
-    //hLength->SetLineStyle(2);
-    hLength->SetNormFactor(1);
-    hLength->Draw("samePE");
-    c2->GetPad(1)->Modified();    
-    c2->GetPad(2)->Update();
-
-    /////////////////////////////////////////////////////////////////
-    char* var="width>>hWidth";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c2->cd(3);
-    c2->GetPad(3)->SetGrid();    
-    title = "width ";  
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("Ehist");
-    c2->GetPad(3)->Update();
-    
-    c2->cd(4);
-    c2->GetPad(4)->SetGrid();    
-    title = "width ";  
-    title = title + cutDist;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t->Draw(var,cutDist, "goff");
-    hWidth->SetXTitle("degrees");
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("Ehist");
-    c2->GetPad(4)->Update();
-    
-    //offdata
-
-    c2->cd(3);
-    c2->GetPad(3)->SetGrid();    
-    title = "width ";  
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c2->GetPad(3)->Modified();    
-    c2->GetPad(3)->Update();
-    
-    c2->cd(4);
-    c2->GetPad(4)->SetGrid();    
-    title = "width ";  
-    title = title + cutDist;
-    hWidth = new TH1F("hWidth",title,nbin, min, max);
-    t2->Draw(var,cutDist, "goff");
-    hWidth->SetXTitle("degrees");
-    //hWidth->SetLineStyle(2);
-    hWidth->SetMarkerStyle(20);
-    hWidth->SetMarkerSize(0.4);
-    hWidth->SetNormFactor(1);
-    hWidth->Draw("samePE");
-    c2->GetPad(4)->Modified();    
-    c2->GetPad(4)->Update();
-
-    /////////////////////////////////////////////////////////////////
-    char* var="conc>>hConc";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c2->cd(5);
-    c2->GetPad(5)->SetGrid();    
-    title = "conc ";  
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,"","goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c2->GetPad(5)->Update();
-    
-    c2->cd(6);
-    c2->GetPad(6)->SetGrid();    
-    title = "conc ";  
-    title = title + cutDist;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t->Draw(var,cutDist,"goff");
-    hConc->SetNormFactor(1.);
-    hConc->Draw("Ehist");
-    c2->GetPad(6)->Update();
-    
-    //offdata
-
-    c2->cd(5);
-    c2->GetPad(5)->SetGrid();    
-    title = "conc ";  
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,"", "goff");
-    //  hConc->SetLineStyle(2);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    hConc->SetNormFactor(1.);
-    hConc->Draw("samePE");
-    c2->GetPad(5)->Modified();    
-    c2->GetPad(5)->Update();
-    
-    c2->cd(6);
-    c2->GetPad(6)->SetGrid();    
-    title = "conc ";  
-    title = title + cutDist;
-    hConc = new TH1F("hConc",title,nbin, min, max);
-    t2->Draw(var,cutDist,"goff");
-    //hConc->SetLineStyle(2);
-    hConc->SetMarkerStyle(20);
-    hConc->SetMarkerSize(0.4);
-    hConc->SetNormFactor(1.);
-    hConc->Draw("samePE");
-    c2->GetPad(6)->Modified();    
-    c2->GetPad(6)->Update();
-    
-    c2->Print(psname); 
-
-    /////////////////////////////////////////////////////////////////
-    char* var="conc6>>hConc6";
-
-    nbin = 40; min = 0.; max = 1.;
-
-    c2->cd(1);
-    title = "conc6 ";  
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,"","goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c2->GetPad(1)->Update();
-    
-    c2->cd(2);
-    title = "conc6 ";  
-    title = title + cutDist;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t->Draw(var,cutDist,"goff");
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("Ehist");
-    c2->GetPad(2)->Update();
-
-    //offdata
-
-    c2->cd(1);
-    title = "conc6 ";  
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,"","goff");
-    //hConc6->SetLineStyle(2);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("samePE");
-    c2->GetPad(1)->Modified();    
-    c2->GetPad(1)->Update();
-    
-    c2->cd(2);
-    title = "conc6 ";  
-    title = title + cutDist;
-    hConc6 = new TH1F("hConc6",title,nbin, min, max);
-    t2->Draw(var,cutDist,"goff");
-    // hConc6->SetLineStyle(2);
-    hConc6->SetMarkerStyle(20);
-    hConc6->SetMarkerSize(0.4);
-    hConc6->SetNormFactor(1.);
-    hConc6->Draw("samePE");
-    c2->GetPad(2)->Modified();    
-    c2->GetPad(2)->Update(); 
-  
-    /////////////////////////////////////////////////////////////////
-    char* var="alpha>>hAlpha";
-
-    nbin = 18; min = 0.; max = 90.;
-
-    c2->cd(3);
-    title = "alpha ";  
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var, "", "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c2->GetPad(3)->Update();
-    
-    c2->cd(4);
-    title = "alpha ";  
-    title = title + cutDist;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t->Draw(var,cutDist, "goff");
-    hAlpha->SetXTitle("degrees");
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("Ehist");
-    c2->GetPad(4)->Update();
-   
-    //offdata
-
-    c2->cd(3);
-    title = "alpha ";  
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var, "", "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c2->GetPad(3)->Modified();    
-    c2->GetPad(3)->Update();
-    
-    c2->cd(4);
-    title = "alpha ";  
-    title = title + cutDist;
-    hAlpha = new TH1F("hAlpha",title,nbin, min, max);
-    t2->Draw(var,cutDist, "goff");
-    hAlpha->SetXTitle("degrees");
-    //hAlpha->SetLineStyle(2);
-    hAlpha->SetMarkerStyle(20);
-    hAlpha->SetMarkerSize(0.4);
-    hAlpha->SetNormFactor(1);
-    hAlpha->Draw("samePE");
-    c2->GetPad(4)->Modified();    
-    c2->GetPad(4)->Update();
-
-
-    /////////////////////////////////////////////////////////////////
-    char* var="log10(size)>>hSize";
-
-    nbin = 40; min = 0.5; max = 4.5;
-
-    c2->cd(5);
-    c2->GetPad(5)->SetLogy(); 
-    title = "size ";  
-    hSize = new TH1F("hSize",title,nbin, min, max);
-    t->Draw(var, "1/MHillas.fSize", "goff");
-    hSize->SetNormFactor(1.);
-    hSize->SetXTitle("log10(ADC counts)");
-    hSize->Draw("Ehist");
-    c2->GetPad(5)->Update();
-    
-    c2->cd(6);
-    c2->GetPad(6)->SetLogy(); 
-    title = "size ";  
-    title = title + cutDist;
-    hSize = new TH1F("hSize",title,nbin, min, max);
-    t->Draw(var,"1/MHillas.fSize*(MHillasSrc.fDist*0.6/189.>0.2 && MHillasSrc.fDist*0.6/189<0.8)", "goff");
-    hSize->SetXTitle("log10(ADC counts)");
-    hSize->SetNormFactor(1.);
-    hSize->Draw("Ehist");
-    c2->GetPad(6)->Update(); 
-
-    //offdata
-    c2->cd(5);
-    c2->GetPad(5)->SetLogy(); 
-    title = "size ";  
-    hSize = new TH1F("hSize",title,nbin, min, max);
-    t2->Draw(var, "1/MHillas.fSize", "goff");
-    hSize->SetXTitle("log10(ADC counts)");
-    hSize->SetNormFactor(1.);
-    hSize->SetMarkerStyle(20);
-    hSize->SetMarkerSize(0.4);
-    //hSize->SetLineStyle(2);
-    hSize->Draw("samePE");
-    c2->GetPad(5)->Modified();    
-    c2->GetPad(5)->Update();
-    
-    c2->cd(6);
-    c2->GetPad(6)->SetLogy(); 
-    title = "size ";  
-    title = title + cutDist;
-    hSize = new TH1F("hSize",title,nbin, min, max);
-    t2->Draw(var,"1/MHillas.fSize*(MHillasSrc.fDist*0.6/189.>0.2 && MHillasSrc.fDist*0.6/189<0.8)", "goff");
-    hSize->SetXTitle("log10(ADC counts)");
-    //hSize->SetLineStyle(2);
-    hSize->SetNormFactor(1.);
-    hSize->SetMarkerStyle(20);
-    hSize->SetMarkerSize(0.4);
-    hSize->Draw("samePE");
-    c2->GetPad(6)->Modified();    
-    c2->GetPad(6)->Update(); 
-       
-    c2->Print(closepsname);                                                    
-  
-}
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/hvnotnominal.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/hvnotnominal.C	(revision 6486)
+++ 	(revision )
@@ -1,167 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier López, 04/2004 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2004
-!
-!
-\* ======================================================================== */
-
-
-Bool_t HandleInput()
-{
-    TTimer timer("gSystem->ProcessEvents();", 50, kFALSE);
-    while (1)
-    {
-        //
-        // While reading the input process gui events asynchronously
-        //
-        timer.TurnOn();
-        TString input = Getline("Type 'q' to exit, <return> to go on: ");
-        timer.TurnOff();
-
-        if (input=="q\n")
-            return kFALSE;
-
-        if (input=="\n")
-            return kTRUE;
-    };
-
-    return kFALSE;
-}
-
-
-void hvnotnominal(const TString filename="20040319_20821_D_Mrk421_S.root", const TString directory="/nfs/magic/CaCodata/2004_03_19/", Float_t percent = 0.01)
-{
-
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-
-  MGeomCamMagic geomcam;
-  MBadPixelsCam badcam;
-  MCameraHV     hvcam;
-
-  // this line is needed because the CC rep rootified file don't have run header,
-  // then the MGeomApply can not initialitaze the containers with the number of 
-  // pixels because this is done in the reinit().
-  badcam.InitSize(geomcam.GetNumPixels());
-  
-  plist.AddToList(&geomcam);
-  plist.AddToList(&badcam);
-  plist.AddToList(&hvcam);
-
-  //
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-
-  // Reads the trees of the root file and the analysed branches
-  MReadReports read;
-  read.AddTree("Camera"); 
-  read.AddFile(directory+filename);     // after the reading of the trees!!!
-  read.AddToBranchList("MReportCamera.*");
-
-  MGeomApply geomapl;
-  MFHVNotNominal fHVNominal;
-  TString hvnominal = "/mnt/users/jlopez/Mars/Files4Mars/Config/HVSettings_FF35q.conf";
-  fHVNominal.SetHVNominalValues(hvnominal);
-  //  fHVNominal.SetMaxNumPixelsDeviated(10);
-  MContinue cont_hv(&fHVNominal);
-
-  tlist.AddToList(&read);
-  tlist.AddToList(&geomapl);
-  tlist.AddToList(&cont_hv);
-
-  //
-  // Create and setup the eventloop
-  //
-  MEvtLoop evtloop;
-  evtloop.SetParList(&plist);
-     
-  //
-  // Execute your analysis
-  //
-
-  MHCamera hvnotnominal(geomcam);
-  MHCamera lowhvnotnominal(geomcam);
-  MHCamera uphvnotnominal(geomcam);
-
-  if (!evtloop.PreProcess())
-    return;
-
-  TArrayD nominal = fHVNominal.GetHVNominal();
-  TArrayD lownominal = nominal;
-  TArrayD upnominal = nominal;
-  
-  for (UInt_t pix=0; pix<nominal.GetSize(); pix++)
-    {
-      lownominal[pix] *= (1-percent);
-      upnominal[pix]  *= (1+percent);
-    }
-  
-  
-  while(tlist.Process())
-    {
-      
-      hvnotnominal.CntCamContent(hvcam,lownominal,0,kFALSE);
-      hvnotnominal.CntCamContent(hvcam,upnominal,0,kTRUE);
-      
-      lowhvnotnominal.CntCamContent(hvcam,lownominal,0,kFALSE);
-      uphvnotnominal.CntCamContent(hvcam,upnominal,0,kTRUE);
-    }
-  
-
-  evtloop.PostProcess();
-  
-  tlist.PrintStatistics();
-  
-  TCanvas c1;
-  c1.Divide(2,1);
-  c1.cd(1);
-  lowhvnotnominal.SetPrettyPalette();
-  lowhvnotnominal.Draw();
-  gPad->cd(1);
-  gPad->Modified();
-  gPad->Update();
-  c1.cd(2);
-  uphvnotnominal.SetPrettyPalette();
-  uphvnotnominal.Draw();
-  gPad->cd(2);
-  gPad->Modified();
-  gPad->Update();
-
-  TCanvas c2;
-  hvnotnominal.SetPrettyPalette();
-  hvnotnominal.Draw();
-  gPad->cd(1);
-  gPad->Modified();
-  gPad->Update();
-
-  if (!HandleInput())
-    break;
-
-}
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillas.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillas.C	(revision 6486)
+++ 	(revision )
@@ -1,558 +1,0 @@
-/*********************************/
-/* Compute the hillas parameters */
-/*********************************/
-
-Bool_t readDatacards(TString& filename);
-
-// initial and final time slices to be used in signal extraction
-const Byte_t hifirst = 0;
-const Byte_t hilast  = 13;
-const Byte_t lofirst = 3;
-const Byte_t lolast  = 12;
-
-// declaration of variables read from datacards
-TString  outname;
-TString  idirname;
-MRunIter pedcaliter;
-MRunIter caliter;
-MRunIter pediter;
-MRunIter datiter;
-ULong_t  nmaxevents=999999999;
-Short_t  calflag=1;
-Float_t  lcore = 3.0;
-Float_t  ltail = 1.5;
-Int_t islflag = 0;
-Float_t  lnew  = 40;
-Int_t  kmethod = 1;
-Int_t    nfiles = 0;
-
-const TString defaultcard="input.datacard";
-
-//Slow control varialbles
-Short_t slowflag=0;
-Bool_t  isSlowControlAvailable = kFALSE;
-TString hvConfigFile="/mnt/users/jlopez/Mars/Files4Mars/Config/HVSettings_FF35q.conf";
-TString continuosLightFile="/local_disk/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
-
-
-/*************************************************************/
-int makeHillas(TString datacard = defaultcard)
-{
-
-  if(!datacard.Length())
-    datacard = defaultcard;
-
-  if(!readDatacards(datacard))
-    {
-      cout << "Error reading datacards. Stoping" << endl;
-      return -1;
-    }
-
-  // Set the general tasks/containers
-  MExtractFixedWindow    extractor;
-  extractor.SetRange(hifirst,hilast,lofirst,lolast);
-
-  MCalibrationQECam   qecam;
-  MBadPixelsCam       badcam;
-  MGeomCamMagic       geomcam;
-  MGeomApply          geomapl;
-
-  cout << endl;
-  cout << "/****************************************************/" << endl;
-  cout << "/* FIRST LOOP: PEDESTAL FOR CALIBRATION COMPUTATION */" << endl;
-  cout << "/****************************************************/" << endl;
-  cout << endl;
-
-  // If you want to exclude pixels from the beginning, read 
-  // an ascii-file with the corr. pixel numbers (see MBadPixelsCam)  
-  ifstream fin("badpixels.dat");
-  badcam.AsciiRead(fin);
-  fin.close();
-
-  MJPedestal pedloop0;
-  pedloop0.SetOutputPath("./");
-  pedloop0.SetInput(&pedcaliter);
-  pedloop0.SetExtractor(&extractor);
-  pedloop0.SetBadPixels(badcam);
-
-  if (!pedloop0.Process())
-    return;
-
-  cout << endl;
-  cout << "/*****************************/" << endl;
-  cout << "/* SECOND LOOP: CALIBRATION  */" << endl;
-  cout << "/*****************************/" << endl;        
-  cout << endl;
-
-  MJCalibration calloop;
-
-  calloop.SetOutputPath("./");
-  calloop.SetExtractor(&extractor);
-  calloop.SetInput(&caliter);
-  calloop.SetQECam(qecam);
-  calloop.SetBadPixels(pedloop0.GetBadPixels());
-  if (!calloop.Process(pedloop0.GetPedestalCam()))
-    return;
-
-  cout << endl;
-  cout << "/*************************************************/" << endl;
-  cout << "/* THIRD LOOP: PEDESTAL CALIBRATION INTO PHOTONS */" << endl;
-  cout << "/*************************************************/" << endl;
-  cout << endl;
-
-  // First Compute the pedestals
-  MJPedestal pedloop;
-  pedloop.SetOutputPath("./");
-  pedloop.SetInput(&pediter);
-
-  if (!pedloop.Process())
-    return;
-
-  MPedestalCam pedcam = pedloop.GetPedestalCam();
-
-  // Now convert this pedestals in photons
-  MParList  plist3;
-  MTaskList tlist3;
-  plist3.AddToList(&tlist3);
-  
-  // containers
-  MCerPhotEvt         nphot;
-  MPedPhotCam         nphotrms;
-  MExtractedSignalCam sigcam;
-
-  plist3.AddToList(&geomcam);
-  plist3.AddToList(&pedcam);
-  plist3.AddToList(&calloop.GetCalibrationCam());
-  plist3.AddToList(&qecam);
-  plist3.AddToList(&badcam);
-  plist3.AddToList(&sigcam);
-  plist3.AddToList(&nphot);
-  plist3.AddToList(&nphotrms);
-
-  
-  MCalibrate::CalibrationMode_t calMode=MCalibrate::kDefault;  
-  if(calflag==0)
-    calMode=MCalibrate::kNone;
-  if(calflag==-1)
-    calMode=MCalibrate::kDummy;
-
-  //tasks
-  MReadMarsFile read3("Events");
-  static_cast<MRead&>(read3).AddFiles(pediter); 
-  read3.DisableAutoScheme();
- 
-//   MReadReports read3;
-//   read3.AddTree("Events","MTime.",kFALSE);
-//   static_cast<MRead&>(read3).AddFiles(pediter); 
-
-   //  MExtractSignal  extsig;
-  //  extsig.SetRange(hifirst,hilast,lofirst,lolast);
-  MCalibrate      photcalc(calMode);
-  MPedPhotCalc    photrmscalc; 
-  
-  tlist3.AddToList(&read3);
-  tlist3.AddToList(&geomapl);
-  tlist3.AddToList(&extractor);
-  tlist3.AddToList(&photcalc);
-  tlist3.AddToList(&photrmscalc);
-
-  // Create and setup the eventloop
-  MEvtLoop evtloop3;
-  evtloop3.SetParList(&plist3);
-  if (!evtloop3.Eventloop())
-    return;
-  
-  tlist3.PrintStatistics();
-
-  cout << "/**********************************************/" << endl;
-  cout << "/* FOURTH LOOP: DATA CALIBRATION INTO PHOTONS */" << endl;
-  cout << "/**********************************************/" << endl;
-
-  MParList  plist4;
-  MTaskList tlist4;
-  plist4.AddToList(&tlist4);
-  
-  // containers 
-  MHillas       hillas;
-  MSrcPosCam    source;
-  MRawRunHeader runhead;
-
-  MArrivalTimeCam   timecam;
-     
-  MIslands      isl;
-  isl.SetName("MIslands1");
-  
-  MIslands      isl2;
-  isl2.SetName("MIslands2");
-
-  MReportDrive  drive;
-  MStarLocalCam starcam;
-
-  if (islflag == 1 || islflag == 2)
-    {
-      plist4.AddToList(&timecam);
-      plist4.AddToList(&isl);
-    }
-  
-  if (islflag == 2)
-    {
-      plist4.AddToList(&isl2);
-    }
-
-  if (isSlowControlAvailable)
-    {
-      plist4.AddToList(&starcam);
-    }
-  
-  
-  plist4.AddToList(&geomcam);
-  plist4.AddToList(&pedcam);
-  plist4.AddToList(&calloop.GetCalibrationCam());
-  plist4.AddToList(&qecam);
-  plist4.AddToList(&badcam);
-  plist4.AddToList(&nphot);
-  plist4.AddToList(&nphotrms);
-  plist4.AddToList(&source);
-  plist4.AddToList(&hillas);
-  plist4.AddToList(&runhead);
-  
-  //tasks
-//   MReadMarsFile read4("Events");
-//   static_cast<MRead&>(read4).AddFiles(datiter); 
-//   read4.DisableAutoScheme();
-
-  MReadReports read4;
-  read4.AddTree("Events","MTime.",kTRUE);
-  read4.AddTree("Currents");
-  read4.AddTree("Camera");
-  read4.AddTree("Drive");
-  static_cast<MRead&>(read4).AddFiles(datiter); 
-  read4.AddToBranchList("MReportCurrents.*");
-
-  // Task that use Slow control information 
-  MFHVNotNominal fhvnotnominal;
-  fhvnotnominal.SetHVNominalValues(hvConfigFile);
-  fhvnotnominal.SetMaxNumPixelsDeviated(40);
- 
-  MContinue hvnotnominal(&fhvnotnominal);
-
-  MCalibrateDC dccalib;
-  dccalib.SetFileName(continuosLightFile);
-
-  const Int_t numblind = 5;
-  const Short_t w[numblind] = { 47, 124, 470, 475, 571};
-  const TArrayS blindpixels(numblind,(Short_t*)w);
-  Float_t ringinterest = 100; //[mm]
-  Float_t tailcut = 3.5;
-  UInt_t integratedevents = 4;
-
-  MFindStars findstars;
-  findstars.SetBlindPixels(blindpixels);
-  findstars.SetRingInterest(ringinterest);
-  findstars.SetDCTailCut(tailcut);
-  findstars.SetNumIntegratedEvents(integratedevents);
-  findstars.SetMinuitPrintOutLevel(-1);
-
-  MSrcPosFromStars srcposfromstar;
-    
-  MBadPixelsTreat   interpolatebadpixels;
-  interpolatebadpixels.SetUseInterpolation();
-  
-  MImgCleanStd      clean(lcore,ltail);
-
-  MArrivalTimeCalc2 timecalc;
-  
-  MIslandCalc       island;
-  island.SetOutputName("MIslands1");
-
-  MIslandClean      islclean(lnew);
-  islclean.SetInputName("MIslands1");
-  islclean.SetMethod(kmethod);
-      
-  MIslandCalc       island2;
-  island2.SetOutputName("MIslands2");  
-  
-  
-  MHillasCalc       hcalc;
-  MHillasSrcCalc    csrc1;
-  
-  MWriteRootFile write(outname,"RECREATE");
-  
-  write.AddContainer("MTime"          , "Parameters");
-  write.AddContainer("MHillas"        , "Parameters");
-  write.AddContainer("MHillasSrc"     , "Parameters");
-  write.AddContainer("MHillasExt"     , "Parameters");
-  write.AddContainer("MNewImagePar"   , "Parameters");
-  write.AddContainer("MRawEvtHeader"  , "Parameters");
-  write.AddContainer("MRawRunHeader"  , "Parameters");
-  write.AddContainer("MConcentration" , "Parameters");
-  write.AddContainer("MSrcPosCam"     , "Parameters");
-
-  if (islflag == 1 || islflag == 2)
-    write.AddContainer("MIslands1" , "Parameters");
-  if (islflag == 2) 
-    write.AddContainer("MIslands2" , "Parameters");
-  if (isSlowControlAvailable)
-    {
-      write.AddContainer("MStarLocalCam" , "Parameters");
-      write.AddContainer("MReportDrive" , "Parameters");
-    }
-  
-  tlist4.AddToList(&read4);
-  tlist4.AddToList(&geomapl);
-  if (isSlowControlAvailable)
-    {
-      tlist4.AddToList(&hvnotnominal,"Events");
-      tlist4.AddToList(&dccalib,"Currents");
-      tlist4.AddToList(&findstars,"Currents");
-      tlist4.AddToList(&srcposfromstar,"Events");
-    }
-                       
-  tlist4.AddToList(&extractor,"Events");
-  tlist4.AddToList(&photcalc,"Events");
-  if(calflag==11)
-    tlist4.AddToList(&interpolatebadpixels);
-  tlist4.AddToList(&clean,"Events");
-
-  if (islflag == 1 || islflag == 2)
-    {
-      tlist4.AddToList(&timecalc,"Events");
-      tlist4.AddToList(&island,"Events");
-    }
-
-  if (islflag == 2)
-    {
-      tlist4.AddToList(&islclean,"Events");
-      tlist4.AddToList(&island2,"Events");
-    }
-  
-  //tlist4.AddToList(&blind2,"Events");
-  tlist4.AddToList(&hcalc,"Events");
-  tlist4.AddToList(&csrc1,"Events");
-  tlist4.AddToList(&write,"Events");
-
-  // Create and setup the eventloop
-  MEvtLoop datloop;
-  datloop.SetParList(&plist4);
-
-  cout << endl;
-  cout << "******************************************************" << endl;
-  cout << "* COMPUTING DATA USING EXTRACTED SIGNAL (IN PHOTONS) *" << endl;
-  cout << "******************************************************" << endl;
-  cout << endl;
-
-  if (!datloop.Eventloop(nmaxevents))
-    return;
-
-  tlist4.PrintStatistics();    
-
-}
-//-------------------------------------------------------------------------------
-
-Bool_t readDatacards(TString& filename)
-{
-  ifstream ifun(filename.Data());
-  if(!ifun)
-    {
-      cout << "File " << filename << " not found" << endl;
-      return kFALSE;
-    }
-
-  TString word;
-  
-  while(ifun >> word)
-    {
-
-      // skip comments
-      if(word[0]=='/' && word[1]=='/')
-	{
-	  while(ifun.get()!='\n'); // skip line
-	  continue;
-	}
-
-      // number of events
-      if(strcmp(word.Data(),"NEVENTS")==0)
-	ifun >> nmaxevents;
-
-
-      // input file directory
-      if(strcmp(word.Data(),"IDIR")==0)
-	{
-	  if(idirname.Length())
-	    cout << "readDataCards Warning: overriding input directory file name" << endl;
-	  ifun >> idirname;
-	}
-
-       // pedestal runs for calibration
-      if(strcmp(word.Data(),"PCRUNS")==0)
-	{
-	  if(pedcaliter.GetNumRuns())
-	    cout << "readDataCards Warning: adding pedestal runs for calibration to the existing list" << endl;
-	  ifun >> word;
-	  pedcaliter.AddRuns(word.Data(),idirname.Data());
-	}
-
-      // calibration runs
-      if(strcmp(word.Data(),"CRUNS")==0)
-	{
-	  if(caliter.GetNumRuns())
-	    cout << "readDataCards Warning: adding calibration runs to the existing list" << endl;
-	  ifun >> word;
-	  caliter.AddRuns(word.Data(),idirname.Data());
-	}
-
-     // pedestal runs for data
-      if(strcmp(word.Data(),"PRUNS")==0)
-	{
-	  if(pediter.GetNumRuns())
-	    cout << "readDataCards Warning: adding pedestal runs for data to the existing list" << endl;
-	  ifun >> word;
-	  pediter.AddRuns(word.Data(),idirname.Data());
-	}
-
-      // data runs
-      if(strcmp(word.Data(),"DRUNS")==0)
-	{
-	  if(datiter.GetNumRuns())
-	    cout << "readDataCards Warning: adding data runs to the existing list" << endl;
-	  ifun >> word;
-	  datiter.AddRuns(word.Data(),idirname.Data());
-	}
-      
-      // output file name
-      if(strcmp(word.Data(),"OUTFILE")==0)
-	{
-	  if(outname.Length())
-	    cout << "readDataCards Warning: overriding output file name" << endl;
-	  ifun >> outname;
-	}
-
-      // calibration flag
-      if(strcmp(word.Data(),"CALFLAG")==0)
-	ifun >> calflag;
-
-      // cleaning level
-      if(strcmp(word.Data(),"CLEANLEVEL")==0)
-	{
-	  ifun >> lcore;
-	  ifun >> ltail;
-	}
-
-      if(strcmp(word.Data(),"ISLFLAG")==0)
-	{
-	  ifun >> islflag;
-	}
-
-      // island cleaning 
-      if (islflag == 2){
-	if(strcmp(word.Data(),"ISLANDCLEAN")==0)
-	  {
-	    ifun >> kmethod;
-	    ifun >> lnew;
-	  }
-      }
-
-      // slow control data available
-      if(strcmp(word.Data(),"SLOWCRT")==0)
-	{
-	  ifun >> slowflag;
-          if (slowflag == 1) isSlowControlAvailable = kTRUE;
-	}
-
-      // hv configuration file
-      if(strcmp(word.Data(),"HVCONFFILE")==0)
-	{
-	  ifun >> hvConfigFile;
-	}
-
-      // countinous light file to calibrate the dc data
-      if(strcmp(word.Data(),"CLFILE")==0)
-	{
-	  ifun >> continuosLightFile;
-	}
-    }
-
-  pedcaliter.Reset();
-  pediter.Reset();
-  caliter.Reset();
-  datiter.Reset();
-  TString pfile;
-
-  // Dump read values
-  cout << "************************************************" << endl;
-  cout << "* Datacards read from file " << filename << endl;
-  cout << "************************************************" << endl;
-  cout << "Pedestal file (s) for calibration: "  << endl;
-  while(kTRUE)
-  {
-      pfile=pedcaliter.Next();
-      if (pfile.IsNull())
-	  break;
-      cout << pfile << endl;
-  }
-  cout << "Calibration file (s): "  << endl;
-  while(kTRUE)
-  {
-      pfile=caliter.Next();
-      if (pfile.IsNull())
-	  break;
-      cout << pfile << endl;
-  }
-  cout << "Pedestal file (s) for data: "  << endl;
-  while(kTRUE)
-  {
-      pfile=pediter.Next();
-      if (pfile.IsNull())
-	  break;
-      cout << pfile << endl;
-  }
-  cout << "Data file (s): "  << endl;
-  while(kTRUE)
-  {
-      pfile=datiter.Next();
-      if (pfile.IsNull())
-	  break;
-      cout << pfile << endl;
-  }
-  cout << "Maximum number of events: " << nmaxevents << endl;
-  cout << "Output file name: " << outname << endl;
-  cout << "Calibration flag: " << calflag << endl;
-  cout << "Cleaning level: ("<<lcore<<","<<ltail<<")" << endl;
-  if (islflag == 1 || islflag == 2)
-    cout << "Island calcultation..." << endl;
-  if (islflag == 2)
-    {
-      cout << "Island Cleaning: "<< kmethod <<" method  "<< lnew << " new threshold" << endl;
-    }
-  cout << "***********" << endl << endl;
-  
-  if(!pediter.GetNumEntries())
-    {
-      cout << "No pedestal file name specified" << endl;
-      return kFALSE;
-    }
-  if(!caliter.GetNumEntries())
-    {
-      cout << "No calibration file name specified" << endl;
-      return kFALSE;
-    }
-  if(!datiter.GetNumEntries())
-    {
-      cout << "No data file name specified" << endl;
-      return kFALSE;
-    }
-  if(!outname.Length())
-    {
-      cout << "No output file name specified" << endl;
-      return kFALSE;
-    }
-
-  if (isSlowControlAvailable)
-    {
-      cout << "HV Configuratin file: " << hvConfigFile << endl;
-      cout << "Continous Light file: " << continuosLightFile << endl;
-    }
-  
-
-  return kTRUE;
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillasMC.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/makeHillasMC.C	(revision 6486)
+++ 	(revision )
@@ -1,435 +1,0 @@
-/* ======================================================================== *\
-   !
-   ! *
-   ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-   ! * Software. It is distributed to you in the hope that it can be a useful
-   ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-   ! * It is distributed WITHOUT ANY WARRANTY.
-   ! *
-   ! * Permission to use, copy, modify and distribute this software and its
-   ! * documentation for any purpose is hereby granted without fee,
-   ! * provided that the above copyright notice appear in all copies and
-   ! * that both that copyright notice and this permission notice appear
-   ! * in supporting documentation. It is provided "as is" without express
-   ! * or implied warranty.
-   ! *
-   !
-   !
-   !   Author(s): Thomas Bretz      5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
-   !              Abelardo Moralejo 1/2004 <mailto:moralejo@pd.infn.it>
-   !              Eva Domingo       1/2005 <mailto:domingo@ifae.es>
-   !             
-   !   Copyright: MAGIC Software Development, 2000-2004
-   !
-   !
-   \* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//
-//  STARMC - STandard Analysis and Reconstruction (MC example)
-//
-//  This macro is a version of the standard converter to convert raw data 
-//  into image parameters, made to show how to run analysis on MC files. 
-//
-//  (1/2005):: Spline extractor added and additional containers written out
-//
-/////////////////////////////////////////////////////////////////////////////
-
-#include "MImgCleanStd.h"
-
-void makeHillasMC()
-{
-  //
-  // This is a demonstration program which calculates the image 
-  // parameters from Magic Monte Carlo files (output of camera).
-
-
-  TString* CalibrationFilename;
-  TString* AnalysisFilename;
-  TString* OutFilename1;
-  TString* OutFilename2;
-
-  TString  rffilename;
-  TString  dispfilename;
-
-  // ------------- USER CHANGE -----------------
-  // Comment line starting "CalibrationFileName" to disable calibration. 
-  // In that case the units of the MHillas.fSize parameter will be ADC counts 
-  // (rather, equivalent ADC counts in inner pixels, since we correct for the 
-  // possible differences in gain of outer pixels)
-
-  // File to be used in the calibration (must be a camera file without added noise)
-  CalibrationFilename = new TString("/mnt/local_wdjrico/jrico/mc/Gammas/Gamma_zbin3_90_7_1290to1299_w0_nonoise.root");
-  // File to be analyzed
-  AnalysisFilename = new TString("/mnt/users/blanch/magic/TestSample/file*.root");
-
-  // Change output file names as desired. 
-  // If you want only one output (not dividing the events in Train and Test samples),
-  // comment the initialization of OutFilename2.
-  OutFilename1 = new TString("/mnt/users/blanch/Temp/Prova.root");
-  //  OutFilename2 = new TString("star_test.root");    // Output file name 2 (train)
-
-  // File to read RandomForest
-  rffilename="/mnt/users/blanch/magic/Mars-All/Mars_Standard06/mtemp/mifae/programs/RFstd.root";
-  // File to read Disp
-  dispfilename="/mnt/users/blanch/magic/Mars-All/Mars_Standard06/mtemp/mifae/programs/DISPstd.root";
-
-  // Fraction of events (taken at random) which one wants to process from the 
-  // file to be analyzed (useful to make smaller files if starting sample is too large).
-  Float_t accepted_fraction = 1.;
-
-
-  // ------------- USER CHANGE -----------------
-  // Cleaning levels
-  Float_t CleanLev[2] = {4.0, 3.5}; // Tail cuts for image analysis
-
-  // Signal extractor
-  // (default=Spline, other extraction methods can be used)
-  const Int_t wsize=2;
-  MExtractor* sigextract = new MExtractTimeAndChargeSpline();
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetTimeType(MExtractTimeAndChargeSpline::kHalfMaximum);
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetChargeType(MExtractTimeAndChargeSpline::kIntegral);      
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetRiseTime((Float_t)wsize*0.25); 
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetFallTime((Float_t)wsize*0.75);  
-  // Define FADC slices to be integrated in high and low gain:
-  sigextract->SetRange(1, 11, 2, 12);
-  // Defines when to switch to low gain
-  sigextract->SetSaturationLimit(240);
-
-
-  // -------------------------------------------
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-  //  MGeomCamMagic geomcam;
-
-  //  MSrcPosCam src;
-  // WOBBLE MODE!!
-  //  src.SetX(120.);  // units: mm
-  //  src.SetXY(0.,0.4/geomcam.GetConvMm2Deg());
-  //  src.SetXY(0.,0.); 
-  //  src.SetReadyToSave();
-
-  MBadPixelsCam badpix;
-
-  //  plist.AddToList(&geomcam);
-  //  plist.AddToList(&src);
-  plist.AddToList(&badpix);
-
-  MCerPhotEvt     nphot;
-  // Stores number of phe
-  plist.AddToList(&nphot);
-  
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-  MReadMarsFile read("Events");
-  if (CalibrationFilename)
-    read.AddFile(CalibrationFilename->Data());
-  read.DisableAutoScheme();
-
-  MGeomApply geom; 
-  // Reads in geometry from MC file and sets the right sizes for
-  // several parameter containers.
-
-  MMcPedestalCopy   pcopy; 
-  // Copies pedestal data from the MC file run fadc header to the MPedestalCam container.
-
-  MPointingPosCalc pointcalc;
-  // Creates MPointingPos object and fill it with the telescope orientation
-  // information taken from MMcEvt.
-
-  MMcCalibrationUpdate  mccalibupdate;
-
-  MCalibrateData calib; 
-  // Transforms signals from ADC counts into photons. In the first
-  // loop it applies a "dummy" calibration supplied by MMcCalibrationUpdate, just 
-  // to equalize inner and outer pixels. At the end of the first loop, in the
-  // PostProcess of MMcCalibrationCalc (see below) the true calibration constants
-  // are calculated.
-  calib.SetCalibrationMode(MCalibrateData::kFfactor);
-
-  //    MBlindPixelCalc   blind;
-  //    blind.SetUseInterpolation();
-
-  MMcCalibrationCalc mccalibcalc; 
-  // Calculates calibration constants to convert from ADC counts to photons.
-
-  MAddGainFluctuation gainfluc;
-  //gainfluc.FillHist(1,0.5);
-  gainfluc.FillHist(0,0.1); // defaul line to not add fluctuations
-  // Adds Gain fluctuations
-
-  MImgCleanStd  clean(CleanLev[0], CleanLev[1]); 
-  // Applies tail cuts to image. Since the calibration is performed on 
-  // noiseless camera files, the precise values of the cleaning levels 
-  // are unimportant for the calibration file processing (in any case, 
-  // only pixels without any C-photon will be rejected).
-  clean.SetCleanRings(1);
-  //  clean.SetRemoveSingle(kFALSE);
-  //  clean.SetMethod(MImgCleanStd::kDemocratic);
-
-  MHillasCalc   hcalc; 
-  // Calculates Hillas parameters.
-
-  tlist.AddToList(&read);
-  tlist.AddToList(&geom);
-  tlist.AddToList(&pcopy);
-  tlist.AddToList(&pointcalc);
-  tlist.AddToList(sigextract);
-  tlist.AddToList(&mccalibupdate);
-  tlist.AddToList(&calib);
-  tlist.AddToList(&clean);
-  //  tlist.AddToList(&blind);
-  tlist.AddToList(&hcalc);
-  tlist.AddToList(&mccalibcalc);
-
-
-  //
-  // Open output files:
-  //
-
-  MWriteRootFile write1(OutFilename1->Data()); // Writes output1
-  write1.AddContainer("MRawRunHeader",       "RunHeaders");
-  write1.AddContainer("MMcRunHeader",        "RunHeaders");
-  write1.AddContainer("MSrcPosCam",          "RunHeaders");
-  write1.AddContainer("MGeomCam",            "RunHeaders");
-  write1.AddContainer("MMcConfigRunHeader",  "RunHeaders");
-  write1.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
-  write1.AddContainer("MMcFadcHeader",       "RunHeaders");
-  write1.AddContainer("MMcTrigHeader",       "RunHeaders");
-  write1.AddContainer("MGainFluctuationCam", "RunHeaders");
-
-  write1.AddContainer("MRawEvtHeader",   "Events");
-  write1.AddContainer("MMcEvt",          "Events");
-  write1.AddContainer("MHillas",         "Events");
-  write1.AddContainer("MHillasExt",      "Events");
-  write1.AddContainer("MHillasSrc",      "Events");
-  write1.AddContainer("MImagePar",       "Events");
-  write1.AddContainer("MNewImagePar",    "Events");
-  write1.AddContainer("MConcentration",  "Events");
-  write1.AddContainer("MIslands",        "Events");
-  write1.AddContainer("MTopology",       "Events");
-  write1.AddContainer("MPointingPos",    "Events");
-  write1.AddContainer("MHadronness",     "Events");
-  write1.AddContainer("MImageParDisp"  , "Events");
-  //write1.AddContainer("MArrivalTimeCam", "Events");
-  //write1.AddContainer("MCerPhotEvt",     "Events");
-
-  if (OutFilename2)
-    {
-      MWriteRootFile write2(OutFilename2->Data()); // Writes output2
-      write2.AddContainer("MRawRunHeader",       "RunHeaders");
-      write2.AddContainer("MMcRunHeader",        "RunHeaders");
-      write2.AddContainer("MSrcPosCam",          "RunHeaders");
-      write2.AddContainer("MGeomCam",            "RunHeaders");
-      write2.AddContainer("MMcConfigRunHeader",  "RunHeaders");
-      write2.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
-      write2.AddContainer("MMcFadcHeader",       "RunHeaders");
-      write2.AddContainer("MMcTrigHeader",       "RunHeaders");
-      write2.AddContainer("MGainFluctuationCam", "RunHeaders");
-
-      write2.AddContainer("MRawEvtHeader",   "Events");
-      write2.AddContainer("MMcEvt",          "Events");
-      write2.AddContainer("MHillas",         "Events");
-      write2.AddContainer("MHillasExt",      "Events");
-      write2.AddContainer("MHillasSrc",      "Events");
-      write2.AddContainer("MImagePar",       "Events");
-      write2.AddContainer("MNewImagePar",    "Events");
-      write2.AddContainer("MConcentration",  "Events");
-      write2.AddContainer("MIslands",        "Events");
-      write2.AddContainer("MTopology",       "Events");
-      write2.AddContainer("MPointingPos",    "Events");
-      write2.AddContainer("MHadronness",     "Events");
-      write2.AddContainer("MImageParDisp"  , "Events");
-      //write2.AddContainer("MArrivalTimeCam", "Events");
-      //write2.AddContainer("MCerPhotEvt",     "Events");
-
-
-      // Divide output in train and test samples, using the event number
-      // (odd/even) to achieve otherwise unbiased event samples:
-      MF filter1("{MMcEvt.fEvtNumber%2}>0.5");
-      MF filter2("{MMcEvt.fEvtNumber%2}<0.5");
-
-      write1.SetFilter(&filter1);
-      write2.SetFilter(&filter2);
-    }
-
-
-  //
-  // FIRST LOOP: Calibration loop (with no noise file)
-  //
-  MProgressBar bar;
-  bar.SetWindowName("Calibrating...");
-
-  MEvtLoop evtloop;
-  evtloop.SetProgressBar(&bar);
-  evtloop.SetParList(&plist);
-
-  if (CalibrationFilename)
-    {
-      if (!evtloop.Eventloop())
-	return;
-      mccalibcalc.GetHistADC2PhotEl()->Write();
-      mccalibcalc.GetHistPhot2PhotEl()->Write();
-      // Writes out the histograms used for calibration.
-    }
-
-  //
-  // SECOND LOOP: TO READ THE RANDOM FOREST FILE(S) 
-  //
-
-  MParList   plistrf;
-  MTaskList  tlistrf;
-  MRanForest ranforest;
-  MRanTree   rantree;
-
-  if(rffilename.Length())
-    {
-      plistrf.AddToList(&tlistrf);
-      plistrf.AddToList(&ranforest);
-      plistrf.AddToList(&rantree);
-
-      MReadTree readrf("Tree",rffilename);
-      readrf.DisableAutoScheme();
-      
-      MRanForestFill rffill;
-      rffill.SetNumTrees(100);
-      
-      tlistrf.AddToList(&readrf);
-      tlistrf.AddToList(&rffill);
-      
-      MEvtLoop evtlooprf;
-      evtlooprf.SetParList(&plistrf);
-      if (!evtlooprf.Eventloop())
-	return;
-      
-      tlistrf.PrintStatistics();
-    }
-  
-
-  //
-  // THIRD LOOP: Analysis loop (process file with noise)
-  //
-  bar.SetWindowName("Analyzing...");
-
-  MIslands         isl;
-  MArrivalTimeCam  timecam;      
-  MTopology        topology;
-  plist.AddToList(&isl);
-  plist.AddToList(&timecam);
-  plist.AddToList(&topology);
-  plist.AddToList(&rantree);
-  plist.AddToList(&ranforest);
- 
-  MArrivalTimeCalc2  timecalc;
-  // Calculates the arrival time as the mean time of the fWindowSize 
-  // time slices which have the highest integral content.
-  //  MArrivalTimeCalc timecalc;            
-  // Calculates the arrival times of photons. Returns the absolute 
-  // maximum of the spline that interpolates the FADC slices.
-
-  MIslandsCalc       islcalc;
-  islcalc.SetOutputName("MIslands");
-  islcalc.SetAlgorithm(1);
-  //  MIslandsClean      islclean(40);
-  //  islclean.SetInputName("MIslands");
-  //  islclean.SetMethod(1);
-
-  MTopologyCalc      topcalc;
-
-  // Change the read task by another one which reads the file we want to analyze:
-  MReadMarsFile read2("Events","/mnt/users/blanch/magic/TestSample/file*.root");
-  //  MReadMarsFile read2("Events","/mnt/users/blanch/magic/TestSample/file53.root");
-  //  read2.AddFile(AnalysisFilename->Data());
-  read2.DisableAutoScheme();
-  tlist.AddToListBefore(&read2, &read);
-  tlist.RemoveFromList(&read);
-
-
-  // Add new tasks (Islands and Topology calculations)
-  tlist.AddToListBefore(&timecalc,&mccalibupdate);
-  tlist.AddToListBefore(&islcalc,&hcalc);
-  //  tlist.AddToListBefore(&islclean,&hcalc);
-  tlist.AddToListBefore(&topcalc,&hcalc);
-
-  // Add Task to Add Gain Fluctuations
-  tlist.AddToListBefore(&gainfluc, &hcalc);
-
-  MGeomCamMagic geomcam;// = new MGeomCam();
-  plist.AddToList(&geomcam);
-
-
-  MHillasDisplay*  disphillas=NULL;
-  disphillas = new MHillasDisplay(&nphot,&geomcam);
-
-  // Analyze only the desired fraction of events, skip the rest:
-  MFEventSelector eventselector;
-  Float_t rejected_fraction = 1. - accepted_fraction; 
-  eventselector.SetSelectionRatio(rejected_fraction);
-  MContinue skip(&eventselector);
-  tlist.AddToListBefore(&skip, sigextract);
-
-  // Remove calibration task from list.
-  tlist.RemoveFromList(&mccalibcalc); 
-
-  // disp
-  // (read in optimum Disp parameter values)  
-  MDispParameters dispin;
-  TArrayD dispPar;
-  if(dispfilename.Length())
-    {
-      TFile inparam(dispfilename);
-      dispin.Read("MDispParameters");
-      cout << "Optimum parameter values taken for calculating Disp : " << endl;
-
-      dispPar =  dispin.GetParameters();
-      for (Int_t i=0; i<dispPar.GetSize(); i++)
-	cout << dispPar[i] << ",  ";
-      cout << endl;
-      
-      inparam.Close();
-    }
-  // Disp results container
-  MImageParDisp imagepardisp;
-  // Disp histograms
-  MHDisp hdisp;
-  hdisp.SetName("MHDispAsym");
-  hdisp.SetSelectedPos(4);
-  MFillH filldisp("MHDispAsym[MHDisp]", "");
-  
-  // Add RandomForest and Disp task computation
-  MRanForestCalc hadrcalc;
-  MDispCalc         dispcalc;  
-
-  tlist.AddToList(&dispcalc);
-  tlist.AddToList(&filldisp);
-  if(rffilename.Length())
-    tlist.AddToList(&hadrcalc);
- 
-  // Add tasks to write output:
-  if (OutFilename2)
-    {
-      tlist.AddToList(&filter1);
-      tlist.AddToList(&filter2);
-      tlist.AddToList(&write2); 
-    }
-  tlist.AddToList(&write1); 
-
-  // Add display image with hillas
-  disphillas->SetPSFile();
-  disphillas->SetPSFileName("provaGF.ps");
-  disphillas->SetPause(kFALSE);	
-  //tlist.AddToList(disphillas);
-  
-
-  if (!evtloop.Eventloop())
-    return;
-
-  tlist.PrintStatistics();
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/mergeClean.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/mergeClean.C	(revision 6486)
+++ 	(revision )
@@ -1,411 +1,0 @@
-/* ======================================================================== *\
-!   Take different MC input files and combine them into single one
-!   Author(s): Oscar Blanch & Javier Rico
-\* ======================================================================== */
-
-void mergeClean()
-{
-  const TString fileout = "/local_disk/jrico/mc/prueba.root";
-
-  const Int_t nfiles = 11;
-  const Int_t nlevels= 5;
-
-  const Char_t* levelname[nlevels]={"noclean","3015","4025","5035","6045"};
-
-  // input files -- no noise
-  const Char_t* NonoiseOutFilename[nfiles] = 
-    {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_nonoise.root",
-     "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_nonoise.root"
-    };
-
-  // input files -- different cleaning levels
-  const Char_t* NoiseOutFilename[nlevels][nfiles]   = 
-    {{"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_noclean.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_noclean.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_noclean.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_noclean.root"},
-     {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_3015.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_3015.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_3015.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_3015.root"},
-     {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_4025.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_4025.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_4025.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_4025.root"},   
-     {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_5035.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_5035.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_5035.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_5035.root"},
-     {"/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0_cleaned_6045.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_0_7_1130to1139_w0_cleaned_6045.root",   
-      "/local_disk/jrico/mc/Gamma_zbin0_90_7_1260to1269_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1010to1019_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_0_7_1140to1149_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin1_90_7_1270to1279_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1020to1029_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin2_0_7_1150to1159_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1030to1039_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_0_7_1160to1169_w0_cleaned_6045.root",
-      "/local_disk/jrico/mc/Gamma_zbin3_90_7_1290to1299_w0_cleaned_6045.root"}
-    };   
-
-
-  // Getting input braches 
-  TChain* tno  = new TChain("Events");
-  TChain* tyes[nlevels];
-  for(Int_t i=0;i<nlevels;i++)
-    tyes[i] = new TChain("Events");
-
-  for(Int_t i=0;i<nfiles;i++)
-    {
-      tno->Add(NonoiseOutFilename[i]);
-      for(Int_t j=0;j<nlevels;j++)
-	tyes[j]->Add(NoiseOutFilename[j][i]);
-    }
-
-  // input braches for no noise file
-  MCerPhotEvt*   nphotNo;
-  MHillas*       hillasNo;
-  MHillasSrc*    hillassrcNo;
-  MMcEvt*        mcevtNo;
-  MRawEvtHeader* evtheaderNo;
-  MRawRunHeader* runheaderNo;
-
-  tno->SetBranchAddress("MCerPhotEvt.",&nphotNo);
-  tno->SetBranchAddress("MHillas.",&hillasNo);
-  tno->SetBranchAddress("MHillasSrc.",&hillassrcNo);
-  tno->SetBranchAddress("MMcEvt.",&mcevtNo);
-  tno->SetBranchAddress("MRawEvtHeader.",&evtheaderNo);
-  tno->SetBranchAddress("MRawRunHeader.",&runheaderNo);
-
-  
-  // input branches for noise files
-  MCerPhotEvt*   nphotYes[nlevels];
-  MHillas*       hillasYes[nlevels];
-  MHillasSrc*    hillassrcYes[nlevels];
-  MMcEvt*        mcevtYes[nlevels];
-  MRawEvtHeader* evtheaderYes[nlevels];
-  MRawRunHeader* runheaderYes[nlevels];
-
-  for(Int_t i=0;i<nlevels;i++)
-    {      
-      tyes[i]->SetBranchAddress("MCerPhotEvt.",&nphotYes[i]);
-      tyes[i]->SetBranchAddress("MHillas.",&hillasYes[i]);
-      tyes[i]->SetBranchAddress("MHillasSrc.",&hillassrcYes[i]);
-      tyes[i]->SetBranchAddress("MMcEvt.",&mcevtYes[i]);
-      tyes[i]->SetBranchAddress("MRawEvtHeader.",&evtheaderYes[i]);
-      tyes[i]->SetBranchAddress("MRawRunHeader.",&runheaderYes[i]);
-    }
-
-  // Setting ouput branches
-  TFile* fout = new TFile(fileout,"RECREATE");
-  TTree* to   = new TTree("Events","Events");   
-
-  // common containers
-  TBranch* bmcevt        = to->Branch("MMcEvt.",       "MMcEvt",       &mcevtNo);
-  TBranch* brawevtheader = to->Branch("MRawEvtHeader.","MRawEvtHeader",&evtheaderNo);
-  TBranch* brawrunheader = to->Branch("MRawRunHeader.","MRawRunHeader",&runheaderNo);
-
-  // noise/cleaning dependent containers
-  to->Branch("MCerPhotEvt0.",  "MCerPhotEvt",  &nphotNo);
-  to->Branch("MHillas0.",      "MHillas",      &hillasNo);
-  to->Branch("MHillasSrc0.",   "MHillasSrc",   &hillassrcNo);
-
-  //  cout << "llego1" << endl;
-  for(Int_t i=0;i<nlevels;i++)
-    {
-      //      cout << "i: " << i << endl;
-      
-      char mcerphot[100];
-      char mhillas[100];
-      char mhillassrc[100];
-
-
-      sprintf(mcerphot,  "MCerPhotEvt%s.",levelname[i]);
-      sprintf(mhillas,   "MHillas%s."    ,levelname[i]);
-      sprintf(mhillassrc,"MHillasSrc%s." ,levelname[i]);
-
-      to->Branch(mcerphot,  "MCerPhotEvt",  &nphotYes[i]);
-      to->Branch(mhillas,   "MHillas",      &hillasYes[i]);
-      to->Branch(mhillassrc,"MHillasSrc",   &hillassrcYes[i]);      
-    }
-  //  cout << "llego2" << endl;
-  
-      
-  Int_t nentries1 = (Int_t)tno->GetEntries();
-  cout << "Entries: No noise file: " << nentries1 << endl;
-  Int_t nentries2[nlevels];
-  Int_t latestk[nlevels];
-  Int_t latestevt[nlevels];
-  Int_t nfound[nlevels];
-  for(Int_t i=0;i<nlevels;i++)
-    {
-      nfound[i]=0;
-      latestk[i]=0;
-      latestevt[i]=99999999;
-      nentries2[i] = (Int_t)tyes[i]->GetEntries();
-      cout << "Entries: cleaning level [" << levelname[i] << "] :" << nentries2[i] << endl;
-    }
-
-  // loop over all events in no-noise file and look for them in the other files
-  for(Int_t i=0;i<nentries1;i++)
-    //  for(Int_t i=0;i<100;i++)
-    {      
-      tno->GetEntry(i);
-      Int_t runno = runheaderNo->GetRunNumber();
-      Int_t evtno = evtheaderNo->GetDAQEvtNumber();
-
-      cout << "Checking run " << runno<< ", event " << evtno << endl;
-
-      //check if the no-noise event is present in all of the other files
-      for(Int_t j=0;j<nlevels;j++)
-	{
-	  Int_t runyes;
-	  Int_t evtyes;
-	  cout << "Level " << levelname[j] << endl;
-	  Int_t k=latestk[j];	  
-	  while(k<nentries2[j])
-	    {
-	      //	      cout << k << endl;
-	      tyes[j]->GetEntry(k++);
-	      runyes = runheaderYes[j]->GetRunNumber();
-	      evtyes = evtheaderYes[j]->GetDAQEvtNumber();
-	      if(runyes==runno && evtyes==evtno)
-		break;
-	      // next condition speeds up selection when events are grouped by runs and
-	      // in event increasing order
-	      if(runyes==runno && latestevt[j]<evtno && evtno<evtyes)
-		break;
-	      // next condition speeds up selection when events are grouped by runs
-	      // and in run increasing order
-	      //	      if(runyes>runno)
-	      //		break;
-	    }
-
-	  if(k>=nentries2[j])
-	    {
-	      k=0;
-	      while(k<latestk[j])
-		{
-		  //		  cout << k << endl;
-		  tyes[j]->GetEntry(k++);
-		  runyes = runheaderYes[j]->GetRunNumber();
-		  evtyes = evtheaderYes[j]->GetDAQEvtNumber();
-		  if(runyes==runno && evtyes==evtno)
-		    break;
-		  // next condition speeds up selection when events are grouped by runs and
-		  // in event increasing order
-		  if(runyes==runno && latestevt[j]<evtno && evtno<evtyes)
-		    break;
-		  // next condition speeds up selection when events are grouped by runs
-		  // and in run increasing order
-		  //		  if(runyes>runno)
-		  //		    break;
-		}
-	    }
-	  
-	  // the event has not been found, assign dummy containers
-	  if(runyes=!runno || evtyes!=evtno)
-	    {
-	      cout << "Not Found!" << endl;	      
-	      for(Int_t l=j;l<nlevels;l++)
-		{
-		  nphotYes[l]->Reset();
-		  hillasYes[l]->Reset();
-		  hillassrcYes[l]->Reset();		  
-		}
-	      break;
-	    }
-	  else
-	    {
-	      cout << "Found!" << endl;
-	      latestevt[j] = evtyes;
-	      latestk[j]=k;	  
-	      nfound[j]++;
-	    }
-	}
-      to->Fill();
-    }
-
-  // loop over all events in first noise file and look for them in the no-noise file in order to save also purely noisy events  
-  cout << "***************************************" << endl;
-  cout << "*** Looking for purely noisy events ***" << endl;
-  cout << "***************************************" << endl;
-  Int_t nfound2[nlevels];
-  for(Int_t i=0;i<nlevels;i++)
-    {
-      nfound2[i]=0;
-      latestk[i]=0;
-      latestevt[i]=99999999;
-    }
-  
-  // readdress the common container addresses
-  bmcevt->SetAddress(&mcevtYes[0]);
-  brawevtheader->SetAddress(&evtheaderYes[0]);
-  brawrunheader->SetAddress(&runheaderYes[0]);
-
-  for(Int_t i=0;i<nentries2[0];i++)
-  //  for(Int_t i=0;i<100;i++)
-    {      
-      tyes[0]->GetEntry(i);
-      Int_t run = runheaderYes[0]->GetRunNumber();
-      Int_t evt = evtheaderYes[0]->GetDAQEvtNumber();
-      Int_t runno;
-      Int_t evtno;
-
-      cout << "Checking run " << run << ", event " << evt << endl;
-
-      //check if the event is present in the no-noise file
-      Int_t kk=latestk[0];	  
-      while(kk<nentries1)
-	{
-	  //	  cout << kk << endl;
-	  tno->GetEntry(kk++);
-	  runno = runheaderNo->GetRunNumber();
-	  evtno = evtheaderNo->GetDAQEvtNumber();
-	  if(run==runno && evt==evtno)
-	    break;
-	  if(run==runno && latestevt[0]<evt && evt<evtno)
-	    break;
-	  //	  if(runno>run)
-	  //	    break;
-	}
-
-      if(kk>=nentries1)
-	{
-	  kk=0;
-	  while(kk<latestk[0])
-	    {
-	      //		  cout << kk << endl;
-	      tno->GetEntry(kk++);
-	      runno = runheaderNo->GetRunNumber();
-	      evtno = evtheaderNo->GetDAQEvtNumber();
-	      if(run==runno && evt==evtno)
-		break;
-	      if(run==runno && latestevt[0]<evt && evt<evtno)
-		break;
-	      //	      if(runno>run)
-	      //		break;
-	    }
-	}
-
-      // the event is already included because it is also a no-noise event, dismiss it
-      if(run==runno && evt==evtno)
-	{
-	  cout << "Found already in the no-noise sample, continuing... " << endl;
-	  latestevt[0] = evtno;
-	  latestk[0]=kk;	  
-	  continue;
-	}
-
-      nfound2[0]++;
-      nphotNo->Reset();
-      hillasNo->Reset();
-      hillassrcNo->Reset();
-
-      // look for the event in the rest of the noisy samples
-      for(Int_t j=1;j<nlevels;j++)
-	{
-	  Int_t runyes;
-	  Int_t evtyes;
-	  cout << "Level " << levelname[j] << endl;
-	  Int_t k=latestk[j];	  
-	  while(k<nentries2[j])
-	    {
-	      //	      cout << k << endl;
-	      tyes[j]->GetEntry(k++);
-	      runyes = runheaderYes[j]->GetRunNumber();
-	      evtyes = evtheaderYes[j]->GetDAQEvtNumber();
-	      if(runyes==run && evtyes==evt)
-		break;
-	      if(runyes==run && latestevt[j]<evt && evt<evtyes)
-		break;
-	      //	      if(runyes>run)
-	      //		break;
-	    }
-
-	  if(k>=nentries2[j])
-	    {
-	      k=0;
-	      while(k<latestk[j])
-		{
-		  //		  cout << k << endl;
-		  tyes[j]->GetEntry(k++);
-		  runyes = runheaderYes[j]->GetRunNumber();
-		  evtyes = evtheaderYes[j]->GetDAQEvtNumber();
-		  if(runyes==run && evtyes==evt)
-		    break;
-		  if(runyes==run && latestevt[j]<evt && evt<evtyes)
-		    break;
-		  //		  if(runyes>run)
-		  //		    break;
-		}
-	    }
-	  
-	  // the event has not been found, assign dummy containers
-	  if(runyes=!run || evtyes!=evt)
-	    {
-	      cout << "Not Found!" << endl;	      
-	      for(Int_t l=j;l<nlevels;l++)
-		{
-		  nphotYes[l]->Reset();
-		  hillasYes[l]->Reset();
-		  hillassrcYes[l]->Reset();		  
-		}
-	      break;
-	    }
-	  else
-	    {
-	      cout << "Found!" << endl;
-	      latestevt[j] = evtyes;
-	      latestk[j]=k;	  
-	      nfound2[j]++;
-	    }
-	}
-      to->Fill();    
-    }
-
-  fout->Write();
-  fout->Close();
-
-  for(Int_t i=0;i<nlevels;i++)
-    cout << "Found " << nfound[i] << "+" << nfound2[i] << " for cleaning level " << levelname[i] << endl;
-
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/mmcCleaning.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/mmcCleaning.C	(revision 6486)
+++ 	(revision )
@@ -1,197 +1,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-//  mmcCleaning - calibrate/clean mc events
-//
-/////////////////////////////////////////////////////////////////////////////
-
-
-void mmcCleaning(TString NoiseFilename, TString NoiseOutFilename)
-{
-  //
-  // This is a demonstration program which reads in MC camera files
-  // and produces and output with calibrated events (signal in photons
-  // for all pixels, in MCerPhotEvt containers).
-  //
-
-  // ------------- user change -----------------
-  Char_t*  NonoiseFilename = "/local_disk/jrico/mc/Gamma_zbin0_0_7_1000to1009_w0.root";
-  //  Char_t*  NoiseFilename   = "/mnt/wdflix/root_0.73mirror/wuerzburg/gammas/Gamma_zbin3_0_7_1160to1169_w0.root"; // File to be analyzed
-
-  //  Char_t* NoiseOutFilename   = "/mnt/users/jrico/prueba.root";   // Output file name
-
-  const Int_t wsize=2;
-  // Signal sigextract
-  // (other extraction methods can be used)
-  MExtractor* sigextract = new MExtractTimeAndChargeSpline();
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetTimeType(MExtractTimeAndChargeSpline::kHalfMaximum);
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetChargeType(MExtractTimeAndChargeSpline::kIntegral);      
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetRiseTime((Float_t)wsize*0.25); 
-  ((MExtractTimeAndChargeSpline*)sigextract)->SetFallTime((Float_t)wsize*0.75);
-  
-  // Define FADC slices to be integrated in high and low gain:
-  sigextract->SetRange(1, 11, 2, 12);
-
-  // Defines when to switch to low gain
-  sigextract->SetSaturationLimit(240);
-
-  // ---------------------------------------------------------------------
-  //
-  // Create a empty Parameter List and an empty Task List
-  // The tasklist is identified in the eventloop by its name
-  //
-  MParList  plist;
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-
-  MPedestalCam  pedcam;
-  MGeomCamMagic geomcam;
-  MCerPhotEvt   nphot;
-
-  plist.AddToList(&pedcam);
-  plist.AddToList(&geomcam);
-  plist.AddToList(&nphot);
-
-  //
-  // Now setup the tasks and tasklist:
-  // ---------------------------------
-  //
-  MReadMarsFile read("Events");
-  read.AddFile(NonoiseFilename);
-  read.DisableAutoScheme();
-
-  MGeomApply geom; 
-  // Reads in geometry from MC file and sets the right sizes for
-  // several parameter containers.
-
-  MMcPedestalCopy   pcopy; 
-  // Copies pedestal data from the MC file run fadc header to the 
-  // MPedestalCam container.
-
-  MDisplay       display(&nphot,&geomcam);
-  MHillasDisplay display2(&nphot,&geomcam);
-
-  MPointingPosCalc pointcalc;
-  // Creates MPointingPos object and fill it with the telescope orientation
-  // information taken from MMcEvt.
-
-  MMcCalibrationUpdate  mccalibupdate;
-
-  MCalibrate calib; 
-  // MCalibrate transforms signals from ADC counts into photons. In the first
-  // loop it applies a "dummy" calibration supplied by MMcCalibrationUpdate, just 
-  // to equalize inner and outer pixels. At the end of the first loop, in the
-  // PostProcess of MMcCalibrationCalc (see below) the true calibration constants
-  // are calculated.
-
-  calib.SetCalibrationMode(MCalibrate::kFfactor);
-
-  MImgCleanStd clean(4.0,3.5);
-  clean.SetCleanRings(1);
-  //  clean.SetRemoveSingle(kFALSE);
-  //
-  // Applies tail cuts to image. Since the calibration is performed on 
-  // noiseless camera files, the precise values of the cleaning levels 
-  // are unimportant (in any case, only pixels without any C-photon will
-  // be rejected).
-  //
-
-  MHillasCalc hcalc; // Calculates Hillas parameters not dependent on source position.
-  MHillasSrcCalc hsrccalc;
-
-  MMcCalibrationCalc mccalibcalc; 
-  // Calculates calibration constants to convert from ADC counts to photons.
-
-  tlist.AddToList(&read);
-  tlist.AddToList(&geom);
-  tlist.AddToList(&pcopy);
-  tlist.AddToList(&pointcalc);
-  tlist.AddToList(sigextract);
-  tlist.AddToList(&mccalibupdate);
-  tlist.AddToList(&calib);
-  tlist.AddToList(&clean);
-  tlist.AddToList(&hcalc);
-  tlist.AddToList(&hsrccalc); 
-  tlist.AddToList(&mccalibcalc);
-  //tlist.AddToList(&display2);
-
-  //
-  // First loop: No noise
-  //
-  MProgressBar bar;
-  bar.SetWindowName("No noise...");
-
-  MEvtLoop evtloop;
-  //  evtloop.SetProgressBar(&bar);
-  evtloop.SetParList(&plist);
-
-  if (!evtloop.Eventloop())
-    return;
-  mccalibcalc.GetHistADC2PhotEl()->Write();
-  mccalibcalc.GetHistPhot2PhotEl()->Write();
-  // Writes out the histograms used for calibration.
-
-
-  //
-  // Second loop: process file with noise
-  //  
-  MIslands      isl;
-  MArrivalTimeCam timecam;      
-  MTopology     topology;
-  plist.AddToList(&isl);
-  plist.AddToList(&timecam);
-  plist.AddToList(&topology);
-
-  MArrivalTimeCalc2 timecalc;
-  MIslandsCalc      islandcalc;
-  islandcalc.SetOutputName("MIslands");
-  islandcalc.SetAlgorithm(1);
-  MIslandsClean     islclean(40);
-  islclean.SetInputName("MIslands");
-  islclean.SetMethod(1);
-  MTopologyCalc     topcalc;
-
-  MReadMarsFile read2("Events");
-  read2.AddFile(NoiseFilename);
-  read2.DisableAutoScheme();
-  tlist.AddToListBefore(&read2, &read, "All");
-  tlist.RemoveFromList(&read);
-
-  tlist.AddToListBefore(&timecalc,&mccalibupdate,"All");
-  tlist.AddToListBefore(&islandcalc,&hcalc,"All");
-  tlist.AddToListBefore(&topcalc,&hcalc,"All");
-
-  MWriteRootFile write(NoiseOutFilename); // Writes output
-  write.AddContainer("MRawRunHeader", "RunHeaders");
-  write.AddContainer("MMcRunHeader",  "RunHeaders");
-  write.AddContainer("MSrcPosCam",    "RunHeaders");
-  write.AddContainer("MGeomCam",      "RunHeaders");
-  write.AddContainer("MMcConfigRunHeader",  "RunHeaders");
-  write.AddContainer("MMcCorsikaRunHeader", "RunHeaders");
-  write.AddContainer("MMcFadcHeader",  "RunHeaders");
-  write.AddContainer("MMcTrigHeader",  "RunHeaders");
-
-  write.AddContainer("MMcEvt",        "Events");
-  write.AddContainer("MRawEvtHeader", "Events");
-  write.AddContainer("MHillas",       "Events");
-  write.AddContainer("MHillasSrc",    "Events");
-  write.AddContainer("MHillasExt",    "Events");
-  write.AddContainer("MConcentration","Events");
-  write.AddContainer("MImagePar",     "Events");
-  write.AddContainer("MNewImagePar",  "Events");
-  write.AddContainer("MIslands",      "Events");
-  write.AddContainer("MPointingPos",  "Events");
-  write.AddContainer("MTopology",      "Events");
-
-  tlist.RemoveFromList(&mccalibcalc);
-  tlist.AddToList(&write);
-  //  tlist.AddToListBefore(&display2,&write, "All");
-
-  bar.SetWindowName("Calibrating/Cleaning...");
-  //  clean.SetRemoveSingle();
-  //  clean.SetMethod(MImgCleanStd::kDemocratic);
-
-  if (!evtloop.Eventloop())
-    return;
-
-  tlist.PrintStatistics();
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/observationTime.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/observationTime.C	(revision 6486)
+++ 	(revision )
@@ -1,48 +1,0 @@
-/* ======================================================================== *\!
-!   Author(s): Javier Rico
-\* ======================================================================== */
-
-void observationTime(
-		     Int_t iniRun=0,
-		     Int_t finRun=99999,
-		     TString filename="/mnt/users/jrico/magic/mars/mars/mtemp/mifae/hillas/AllCrabNebula_3015_kDefault_MispE.root"
-)
-{    
-    // define files, chains...
-    TChain* t= new TChain("Parameters");
-    t->Add(filename);
-
-    // define aliases
-    t->SetAlias("run",     "MRawRunHeader.fRunNumber");
-    t->SetAlias("runiniT", "MRawRunHeader.fRunStart.fTime.fMilliSec/1000");
-    t->SetAlias("runfinT", "MRawRunHeader.fRunStop.fTime.fMilliSec/1000");
-
-    TH1I* hrun = new TH1I("hrun","",finRun-iniRun+1,iniRun,finRun+1);
-    TH1I* hent = new TH1I("hent","",finRun-iniRun+1,iniRun,finRun+1);
-	
-    const char varcut[512];
-    const char runcut[512];
-    sprintf(runcut,"(run>=%d && run<=%d)",iniRun,finRun);
-    sprintf(varcut,"%s*(runfinT-runiniT)",runcut);
-
-    t->Draw("run>>hrun",runcut);
-    t->Draw("run>>hent",varcut);
-
-    Float_t seconds=0;
-    for(Int_t irun = 1; irun<=finRun-iniRun+1; irun++)
-      {
-	Int_t nev;
-	if(nev=hrun->GetBinContent(irun))
-	  {
-	    Float_t time = hent->GetBinContent(irun)/nev;
-	    seconds += time;	    
-	    cout << "run " << iniRun-1+irun << ", " << time <<  " seconds" << endl;
-	  }
-      }
-    
-    cout << "Total observation time = " << seconds << " seconds = " << seconds/60. << " minutes = " << seconds/3600. << " hours" << endl;
-    delete hrun;
-    delete hent;
-}
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/pedrmsonoff.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/pedrmsonoff.C	(revision 6486)
+++ 	(revision )
@@ -1,284 +1,0 @@
-// pedrmsonoff.C
-// compare pedestal rms for two different sets
-//
-
-#include "MParList.h"
-#include "MTaskList.h"
-#include "MPedestalCam.h"
-#include "MReadMarsFile.h"
-#include "MGeomApply.h"
-#include "MPedCalcPedRun.h"
-#include "MEvtLoop.h"
-#include "MPedestalPix.h"
-#include "MHCamera.h"
-
-#include "TTimer.h"
-#include "TString.h"
-#include "TCanvas.h"
-#include "TFile.h"
-#include "TGraphErrors.h"
-#include "TMultiGraph.h"
-#include "TLegend.h"
-#include "TPaveStats.h"
-#include "TH1F.h"
-#include "TStyle.h"
-#include "TROOT.h"
-
-#include <iostream>
-
-using namespace std;	     
-
-void compare(TCanvas* canvas,TString onfname, TString offfname,TString descon, TString descoff, UInt_t index=-1);
-
-void pedrmsonoff()
-//int main()
-{
-  // general settings
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetStatColor(0);
-  gStyle->SetStatBorderSize(1);
-  gStyle->SetOptStat(111111);
-  gStyle->SetStatW(0.2);
-  gStyle->SetStatH(0.1);
-  gStyle->SetStatX(0.9);
-  gStyle->SetStatY(0.9);
-
-  // create canvas
-  TCanvas* canvas = new TCanvas("canvas","On/Off crab pedestal rms", 0, 100, 800, 500);
-  canvas->SetBorderMode(0);    // Delete the Canvas' border line     
-  canvas->cd();
-
-#ifdef TEMPLATE
-  // define input files/parameters
-  const UInt_t ncomp = 9;
-
-  //  const TString onfile ="/mnt/disc02/Data/rootdata/CrabNebula/2004_01_26/20040125_10412_P_Crab-On_E.root";
-  TString onfile[ncomp] = {
-    "/local_disk/jrico/rootdata/20040126_12149_P_Cab-On_E.root",
-    "/local_disk/jrico/rootdata/20040125_10412_P_Crab-On_E.root", 
-    "/local_disk/jrico/rootdata/20040125_10412_P_Crab-On_E.root",
-    "/local_disk/jrico/rootdata/20040119_04642_P_Crab-On_E.root",
-    "/local_disk/jrico/rootdata/20040128_1342*_P_ClosedLidsHVoff_E.root",
-    "/local_disk/jrico/rootdata/20040128_1342*_P_ClosedLidsLVoff_E.root",
-    "/local_disk/jrico/rootdata/20040128_1343*_P_ReciversOff_E.root",
-    "/local_disk/jrico/rootdata/20040126_12386_P_Cab-On_E.root",
-    "/local_disk/jrico/rootdata/20040126_12543_P_OffCrab-1_E.root"};
-
-  
-  TString ondesc[ncomp] = {"Run 12149 Jan 27th, Crab On, #theta 28 deg",
-			   "Run 10412 Jan 26th, Crab On, #theta 12.5 deg",
-			   "Run 10412 Jan 26th, Crab On, #theta 12.5 deg",			      
-			   "Run 4642 Jan 20th, Crab On, #theta 14.1 deg",
-			   "Runs 13426-7 Jan 29th, Closed lids HV off",
-			   "Runs 13428-9 Jan 29th, Closed lids LV off",
-			   "Runs 13430-1 Jan 29th, Recivers Off",
-			   "Run 12386 Jan 27th, Crab On #theta 37.1 deg",
-			   "Run 12543 Jan 27th, Crab Off #theta 8.6 deg"};
-
-  
-  TString offfile[ncomp] = {
-    "/local_disk/jrico/rootdata/20040121_06773_P_OffCrab1_E.root",
-    "/local_disk/jrico/rootdata/20040125_11477_P_OffCrab1_E.root",
-    "/local_disk/jrico/rootdata/20040125_10415_P_Crab-On_E.root",
-    "/local_disk/jrico/rootdata/20040125_10415_P_Crab-On_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root",
-    "/local_disk/jrico/rootdata/20040128_13425_P_ClosedLidsHVon_E.root"};
-
-  
-  TString offdesc[ncomp] = {"Run 6773 Jan 22nd, Crab Off #theta 28 deg",
-			    "Run 11477 Jan 26th, Crab Off #theta 9.2 deg",
-			    "Run 10415 Jan 26th, Crab On, #theta 13.8 deg",
-			    "Run 10415 Jan 26th, Crab On, #theta 13.8 deg",
-			    "Run 13425 Jan 29th, Closed lids HV on",
-			    "Run 13425 Jan 29th, Closed lids HV on",
-			    "Run 13425 Jan 29th, Closed lids HV on",
-			    "Run 13425 Jan 29th, Closed lids HV on",
-			    "Run 13425 Jan 29th, Closed lids HV on"};
-#endif
-
-  // define input files/parameters
-  const UInt_t ncomp = 1;
-
-  TString onfile[ncomp] = {"/local_disk/jrico/rootdata/pedestals/20040619_*_P_OffPSR1957-1_E.root"};  
-  TString ondesc[ncomp] = {"Off-PSR1957"};  
-  TString offfile[ncomp] = {"/local_disk/jrico/mc/empty_disc00.root"};  
-  TString offdesc[ncomp] = {"MC (Vela)"};
-
-  canvas->Print("pedrmsonoff.ps[");  
-  for(UInt_t i=0;i<ncomp;i++)    
-    compare(canvas,onfile[i],offfile[i],ondesc[i],offdesc[i],i);
-  canvas->Print("pedrmsonoff.ps]");  
-}
-
-
-void compare(TCanvas* canvas,TString onfname, TString offfname,TString descon, TString descoff,UInt_t index)
-{
-  /*************************/
-  /* FIRST LOOP: ON DATA   */
-  /*************************/
-
-  // basic lists
-  MParList plist;
-  MTaskList tlist;
-  plist.AddToList(&tlist);
-  
-  // containers
-  MPedestalCam   onpedcam;
-  plist.AddToList(&onpedcam);
-    
-  //tasks
-  MReadMarsFile read("Events", onfname);
-  MGeomApply     geomapl;
-  MPedCalcPedRun pedcalc;
-
-  read.DisableAutoScheme();
-
-  tlist.AddToList(&read);
-  tlist.AddToList(&geomapl);
-  tlist.AddToList(&pedcalc);
-
-  // Create and execute the event looper
-  MEvtLoop evtloop;
-  evtloop.SetParList(&plist);
-  
-  cout << "*********************" << endl;
-  cout << "** RUNNING ON DATA **" << endl;
-  cout << "*********************" << endl;
-
-  if (!evtloop.Eventloop())
-    return;
-  
-  tlist.PrintStatistics();
-
-  /**************************/
-  /* SECOND LOOP: OFF DATA  */
-  /**************************/
-  MReadMarsFile read2("Events",offfname);
-  read2.DisableAutoScheme();
-  tlist.AddToListBefore(&read2, &read, "All");
-  tlist.RemoveFromList(&read);
-  
-  // containers
-  MPedestalCam   offpedcam;
-  plist.Remove(&onpedcam);
-  plist.AddToList(&offpedcam);
-  
-  // Execute the event looper
-  cout << "**********************" << endl;
-  cout << "** RUNNING OFF DATA **" << endl;
-  cout << "**********************" << endl;
-
-  if (!evtloop.Eventloop())
-    return;
-  
-  tlist.PrintStatistics();
-
-  /*******************/
-  /* FILL HISTOGRAMS */
-  /*******************/
-  const UInt_t npix = 577;
-  const UInt_t ninner = 397;
-  const UInt_t imin =  0;
-  const UInt_t imax = 20;
-  const UInt_t itot = 50;
-  
-  TH1F* honinpedrms  = new TH1F(descon+TString(" Inner"),"Pedestal RMS" ,itot,imin,imax);
-  TH1F* hoffinpedrms = new TH1F(descoff+TString(" Inner"),"Pedestal RMS",itot,imin,imax);
-  TH1F* honoutpedrms  = new TH1F(descon+TString(" Outer"),"Pedestal RMS" ,itot,imin,imax);
-  TH1F* hoffoutpedrms = new TH1F(descoff+TString(" Outer"),"Pedestal RMS",itot,imin,imax);
-
-  for(UInt_t i=0;i<npix;i++)
-    {
-      const Float_t onpedrms  =  onpedcam[i].GetPedestalRms();
-      const Float_t offpedrms = offpedcam[i].GetPedestalRms();
-      
-      if(i<ninner)
-	{
-	  honinpedrms->Fill(onpedrms);
-	  hoffinpedrms->Fill(offpedrms);
-	}
-      else
-	{
-	  honoutpedrms->Fill(onpedrms);
-	  hoffoutpedrms->Fill(offpedrms);
-	}
-    }
-
-  /*******************/
-  /* DRAW HISTOGRAMS */
-  /*******************/
-     
-  // draw pedestal histos
-  honinpedrms->GetXaxis()->SetTitle("Pedestal RMS (ADC cnts)");
-  honinpedrms->GetYaxis()->SetTitle("# pixels");
-  honinpedrms->SetFillStyle(3004);
-  honinpedrms->SetFillColor(1);
-
-  hoffinpedrms->GetXaxis()->SetTitle("Pedestal RMS (ADC cnts)");
-  hoffinpedrms->GetYaxis()->SetTitle("# pixels");
-  hoffinpedrms->SetFillStyle(3005);
-  hoffinpedrms->SetFillColor(2);
-  hoffinpedrms->SetLineColor(2);
-
-  honoutpedrms->GetXaxis()->SetTitle("Pedestal RMS (ADC cnts)");
-  honoutpedrms->GetYaxis()->SetTitle("# pixels");
-  honoutpedrms->SetFillStyle(3017);
-  honoutpedrms->SetFillColor(1);
-
-  hoffoutpedrms->GetXaxis()->SetTitle("Pedestal RMS (ADC cnts)");
-  hoffoutpedrms->GetYaxis()->SetTitle("# pixels");
-  hoffoutpedrms->SetFillStyle(3018);
-  hoffoutpedrms->SetFillColor(2);
-  hoffoutpedrms->SetLineColor(2);
-
-  hoffinpedrms->Draw();
-  hoffoutpedrms->Draw("sames");
-  honinpedrms->Draw("sames");
-  honoutpedrms->Draw("sames");
-
-  // move stat boxes to make them all visible
-  gPad->Update();
-  TPaveStats* onoutpavstat  = (TPaveStats*) honoutpedrms->GetListOfFunctions()->FindObject("stats");
-  TPaveStats* offinpavstat  = (TPaveStats*) hoffinpedrms->GetListOfFunctions()->FindObject("stats");
-  TPaveStats* offoutpavstat = (TPaveStats*) hoffoutpedrms->GetListOfFunctions()->FindObject("stats");
-  Float_t shifty = offinpavstat->GetY2NDC()-offinpavstat->GetY1NDC();
-  Float_t shiftx = onoutpavstat->GetX2NDC()-onoutpavstat->GetX1NDC();
-
-  onoutpavstat->SetX1NDC(onoutpavstat->GetX1NDC()-shiftx);
-  onoutpavstat->SetX2NDC(onoutpavstat->GetX2NDC()-shiftx);
-
-  offinpavstat->SetY1NDC(offinpavstat->GetY1NDC()-shifty);
-  offinpavstat->SetY2NDC(offinpavstat->GetY2NDC()-shifty);
-
-  offoutpavstat->SetX1NDC(offoutpavstat->GetX1NDC()-shiftx);
-  offoutpavstat->SetX2NDC(offoutpavstat->GetX2NDC()-shiftx);
-  offoutpavstat->SetY1NDC(offoutpavstat->GetY1NDC()-shifty);
-  offoutpavstat->SetY2NDC(offoutpavstat->GetY2NDC()-shifty);
-
-  // include legend
-  TLegend* leg1 = new TLegend(.52,.25,.88,.45);
-  leg1->SetHeader("");
-  leg1->AddEntry(honinpedrms,descon+TString(" (Inner)"),"f");
-  leg1->AddEntry(hoffinpedrms,descoff+TString(" (Inner)"),"f");
-  leg1->AddEntry(honoutpedrms,descon+TString(" (Outer)"),"f");
-  leg1->AddEntry(hoffoutpedrms,descoff+TString(" (Outer)"),"f");
-  leg1->SetFillColor(0);
-  leg1->SetLineColor(0);
-  leg1->SetBorderSize(0);
-  leg1->Draw();
-
-  if(index>=0)
-    {
-      char fname[100];
-      sprintf(fname,"pedrmsonoff%02d.eps",index);
-      canvas->Print(fname);        
-    }
-  canvas->Print("pedrmsonoff.ps");  
-
-  return; 
-  
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/plotOptimal.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/plotOptimal.C	(revision 6486)
+++ 	(revision )
@@ -1,124 +1,0 @@
-////////////////////////////////////////////////////////////////////////////////////
-//
-//             _____ Plot Optimized cuts _____
-//
-//  Take as input an output from programs/optimizeCuts and plot the results
-//  You only need to specify the input file name
-//
-//                 Jose Flix    <jflix@ifae.es>
-//                 Javier Rico  <jrico@ifae.es>
-////////////////////////////////////////////////////////////////////////////////////
-
-
-void plotOptimal(TString fname="optimize.out")
-{
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetOptStat(000000);
-  gStyle->SetPalette(1);
-
-  ifstream ifun(fname.Data());
-  Float_t width,length,excess,significance;
-
-  Float_t wmin=9999999;
-  Float_t lmin=9999999;
-  Float_t wmax=-9999999;
-  Float_t lmax=-9999999;
-  Float_t emax=-9999999;
-  Float_t smax=-9999999;
-
-  Float_t dw=-1;
-  Float_t dl=-1;
-  Float_t prevw=-1;
-  Float_t prevl=-1;
-
-  // first loop to get parameters
-  Int_t i=0;
-  while(ifun >> width)
-    {
-      // read data
-      ifun >> length;
-      ifun >> excess;
-      ifun >> significance;
-      
-      // keep max/min
-      if(width<wmin)  wmin=width;
-      if(length<lmin) lmin=length;
-      if(width>wmax)  wmax=width;
-      if(length>lmax) lmax=length;
-      if(significance>smax) 
-	{
-	  smax=significance;
-	  emax=excess;
-	}
-
-      if(width!=prevw)   dw=width-prevw;
-      if(length!=prevl) dl=length-prevl;
-
-      prevw=width;
-      prevl=length;
-      i++;
-    }
-  ifun.close();
-
-  cout << "wmin: " << wmin << ", wmax: " << wmax+dw << ", lmin: " << lmin << ", lmax: " << lmax+dl << endl;
-
-  // define histos
-  Int_t nx = TMath::Nint((wmax-wmin)/dw)+1;
-  Int_t ny = TMath::Nint((lmax-lmin)/dl)+1;
-  TH2F *ex  = new TH2F("Excess","Excess",nx,wmin,wmax+dw,ny,lmin,lmax+dl);
-  TH2F *sig = new TH2F("Significance","Significance",nx,wmin,wmax+dw,ny,lmin,lmax+dl);
-
-  cout << "nx: " << nx << ", ny: " << ny << endl;
-  cout << "dw: " << dw << ", dl: " << dl << endl;
-
-  ifstream ifun2;
-  ifun2.open(fname.Data());
-  
-  // second loop to fill the histograms
-  Float_t wopt,lopt,eopt;
-  while(ifun2 >> width)
-    {
-      // read data
-      ifun2 >> length;
-      ifun2 >> excess;
-      ifun2 >> significance;
-
-      cout << "Width: " << width << '\t' << "Length: " << length << '\t' << "Excess: " << excess << '\t' << "Significance: " << significance;
-      if(significance==smax)
-	{
-	  cout << " *****";
-	  wopt=width;
-	  lopt=length;
-	  eopt=excess;
-	}
-	    
-      cout << endl;
-
-      Int_t binx = TMath::Nint(((width-wmin)/dw));
-      Int_t biny = TMath::Nint(((length-lmin)/dl));
-
-      //      cout << "binnx: " << binx+1 << ", biny: " << biny+1 << endl;
-
-      ex->SetBinContent(binx+1,biny+1,excess+.00001);
-      sig->SetBinContent(binx+1,biny+1,significance+.00001);    
-    }
-  cout << "Maximal significance: " << smax << " (excess=" << eopt << ") for width="<<wopt<<", length=" << lopt << endl;
-
-  // plot
-  TCanvas *c3 = new TCanvas("c3","c3",0,0,500,750);
-  c3->Divide(1,2);
-  
-  c3->cd(1);
-  ex->GetXaxis()->SetTitle("Width (degrees)");
-  ex->GetYaxis()->SetTitle("Length (degrees)");
-  ex->Draw("colz");
-  
-  c3->cd(2);
-  sig->GetXaxis()->SetTitle("Width (degrees)");
-  sig->GetYaxis()->SetTitle("Length (degrees)");
-  sig->Draw("colz");
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/rotation.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/rotation.C	(revision 6486)
+++ 	(revision )
@@ -1,101 +1,0 @@
-
-// Macro to compare the rotation obtained from simple FOV rotation, with 
-// measured values
-
-void rotation()
-{
-  const Int_t rmax=17427;
-  gStyle->SetMarkerStyle(20);
-  gStyle->SetMarkerSize(1);
-
-  const char* fname="/mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/macros/20040215_Mrk421.B.pos";
-  TFile* file= new TFile("/mnt/users/jrico/magic/mars/Mars_Standard02/mtemp/mifae/hillas/mrk20040215OnRotateNoCalB.root");
-  TTree* chain = (TTree*)file->Get("Parameters");
-
-  // read position data from file
-  ifstream ifun(fname);
-
-  Int_t irun;
-  Float_t ix;
-  Float_t iy;
-
-  // first loop to evaluate number of entries
-  Int_t nentries=0;  
-  while(ifun >> irun)
-    {
-      ifun >> ix;
-      ifun >> iy;
-      nentries++;
-    }
-  ifun.close();
-  const Int_t size = nentries;
-  Float_t x[size];
-  Float_t y[size];
-  Int_t run[size];
-
-  // second loop to actually read values into arrays
-  Int_t i=0;
-  ifstream ifun2(fname);
-  while(ifun2 >> run[i])
-    {
-      ifun2 >> x[i];
-      ifun2 >> y[i];
-      x[i]/=315.;
-      y[i]/=315.;
-      i++;
-    }  
-  ifun2.close();
-  TGraph* tray = new TGraph(nentries,x,y);
-
-  // get data from tree
-  MSrcPosCam* srpos = new MSrcPosCam; 
-  MRawRunHeader* hrun = new MRawRunHeader;
-  chain->SetBranchAddress("MSrcPosCam.",&srpos);
-  chain->SetBranchAddress("MRawRunHeader.",&hrun);
-
-  Int_t ntot = chain->GetEntries();
-  const Int_t ctot =ntot;
-  Float_t xth[ctot];
-  Float_t yth[ctot];
-  Int_t rtot=0;
-  for(Int_t j=0;j<ctot;j++)
-    {
-      chain->GetEntry(j);
-      Int_t arun=hrun->GetRunNumber();
-      if(arun<=rmax)
-	{
-	  xth[j]=srpos->GetX()/315.;
-	  yth[j]=srpos->GetY()/315.;
-	  rtot++;
-	}
-    }     
-  TGraph* trayth = new TGraph(rtot,xth,yth);
-  
-
-  // Plot   
-  TPostScript myps("rotation.ps",111);
-  myps.Range(15,15);
-  TCanvas* myC = new TCanvas("myC","pedestal studies",500,500);
-  myC->cd(1);
-
-  // Null graph to adjust plot limits
-  Float_t nullx[2]={-0.4,0.4};
-  Float_t nully[2]={-0.4,0.4};
-
-  TGraph grnull(2,nullx,nully);
-  grnull.SetMarkerSize(0);
-  grnull.SetMarkerColor(0);
-  grnull.GetXaxis()->SetTitle("x (deg)");
-  grnull.GetYaxis()->SetTitle("y (deg)");
-  grnull.SetTitle("Source position in camera Mrk421 15th February");
-  grnull.DrawClone("AP");
-
-  tray->SetMarkerStyle(2);
-  tray->SetMarkerSize(2);
-  trayth->SetMarkerStyle(6);
-  trayth->SetMarkerColor(2);
-
-  tray->DrawClone("P");
-  trayth->DrawClone("P");
-  myps.Close();
-}
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/signal.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/signal.C	(revision 6486)
+++ 	(revision )
@@ -1,180 +1,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-//       This macro makes the two-dimension plot of the False Source Method:
-//        root > .x signal.C(TString name, TString psname)
-//
-//                 Ester Aliu   <aliu@ifae.es>
-//                 Oscar Blanch <blanch@ifae.es>
-//                 Javier Rico  <jrico@ifae.es>
-////////////////////////////////////////////////////////////////////////////
-void signal(
-TString fname ="hillasCrab/falseSourceCrab20040215.root",
-TString psname ="kk.ps")
-{
-  Float_t excess;
-  Float_t significance;
-  Float_t array[2];
-  
-  Int_t nbin2d = 5;
-  Int_t ntotal = 2*nbin2d+1;
-  
-  Int_t nx = 0;
-  Int_t ny = 0;
-  
-  Float_t max = -10000;
-  Int_t imax;
-  Int_t jmax;
-  Float_t A ;
-  Float_t B;
-  
-  TH2F *hsignif = new TH2F("hsignif","Significance", ntotal, -1.0, 1.0, ntotal, -1.0, 1.0);
-  TH2F *hexcess = new TH2F("hexcess","Excess", ntotal, -1.0, 1.0, ntotal, -1.0, 1.0);
-  
-  
-  // loop on the histos and compute excess and significance
-  for( Int_t i = -nbin2d; i <= nbin2d ; i++)  
-    {    
-      nx++;
-      ny = 0;
-      for( Int_t j = -nbin2d; j <= nbin2d ; j++)  
-	{	
-	  ny++;	  
-	  step_signal(i,j,&array[0], fname);
-	  
-	  excess = array[0];
-	  significance = array[1];
-
-	  hexcess->SetBinContent(nx, ny, excess);
-	  hsignif->SetBinContent(nx, ny, significance);
-
-	  if ( significance > max)
-	    {
-	      max = significance;
-	      imax = i;
-	      jmax = j;
-	      A = excess;
-	      B = significance;
-	    }
-	}
-    }
-  
-  cout << "The position of maximum significance is ( " << imax << " , " << jmax << " )" << endl;
-  cout << "Excess: " << A << endl;
-  cout << "Significance: " << B << endl;
-    
-  // Plot 
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetOptTitle(0);
-  gStyle->SetTitleOffset(1.7,"y");
-  gStyle->SetPadLeftMargin(0.15);
-  gStyle->SetOptStat(kFALSE);
-  gStyle->SetStatColor(0);
-  gStyle->SetStatBorderSize(1);
-  gStyle->SetStatW(0.2);
-  gStyle->SetStatH(0.1);
-  gStyle->SetStatX(0.9);
-  gStyle->SetStatY(0.9);
-  
-
-  TPostScript myps(psname,111);
-  myps.Range(15,15);
-  TCanvas *c2d = new TCanvas("c2d", "Matrices", 0, 0, 800,800);  
-  c2d->Divide(2,2);
-  gStyle->SetPalette(1); 
-  
-  c2d->cd(1);
-  hexcess->Draw("colz");
-  hexcess->SetXTitle("X position (deg)");
-  hexcess->SetYTitle("Y position (deg)");
-  gPad->Update();    
-  
-  c2d->cd(2);
-  hsignif->Draw("colz");
-  hsignif->SetXTitle("X position (deg)");
-  hsignif->SetYTitle("Y position (deg)");
-  gPad->Update();
-
-  c2d->cd(3);
-  hexcess->Draw("lego2");
-  hexcess->SetXTitle("X position (deg)");
-  hexcess->SetYTitle("Y position (deg)");
-  gPad->Update();    
-  
-  c2d->cd(4);
-  hsignif->Draw("lego2");
-  hsignif->SetXTitle("X position (deg)");
-  hsignif->SetYTitle("Y position (deg)");
-  gPad->Update();    
-
-  myps.Close();
-}
-  
-  
-void step_signal(Int_t i, Int_t j, Float_t *array, TString fname) 
-{
-  cout << "Bin (" << i << "," << j << ")" << endl;
-  TH1F *onhisto;
-  TH1F *offhisto;
-
-  // open file and access to the histograms  
-  TFile *f = new TFile(fname);
-  Char_t name[20]; 
-  Char_t title[50]; 
-
-  // histo name
-  sprintf(name,"hOnAlpha[%d][%d]", i, j);
-  sprintf(title,"Alpha-Plot(On data) (%d ,%d)", i, j);
-  onhisto = (TH1F*)gDirectory->Get(name);   
-  
-  sprintf(name,"hOffAlpha[%d][%d]", i, j);
-  sprintf(title,"Alpha-Plot(Off data) (%d ,%d)", i, j);
-  offhisto = (TH1F*)gDirectory->Get(name);   
-  
-  // line/normalization
-  const Int_t nbins = 18;
-  const Int_t inibin = 20./90.*nbins+1;
-  Float_t level=0;
-  Float_t leveloff=0;
-  Float_t levelofferror=0;
-  for(Int_t ibin = inibin; ibin<=nbins;ibin++)
-    {
-      level+=onhisto->GetBinContent(ibin);
-      leveloff+=offhisto->GetBinContent(ibin);
-    }
-  level/=(nbins-inibin+1);
-  leveloff/=(nbins-inibin+1);
-  
-  // normalize on/off
-  offhisto->Sumw2(); // needed to compute correct errors after normalization
-  const Float_t norm = level/leveloff;
-  cout << "Normalizing by factor " << norm <<endl;
-  offhisto->Scale(norm);    
-  
-  // significance:
-  Float_t sig=0,bg=0,esig=0,ebg=0;
-  Float_t significance=0;
-  const Int_t signbins = inibin-1;
-  for(Int_t ibin = 1; ibin<=signbins;ibin++)
-    {
-      sig  += onhisto->GetBinContent(ibin);
-      esig += onhisto->GetBinError(ibin)*onhisto->GetBinError(ibin);
-      bg   += offhisto->GetBinContent(ibin);
-      ebg  += offhisto->GetBinError(ibin)*offhisto->GetBinError(ibin);
-    }
-  Float_t error= TMath::Sqrt(esig+ebg);
-  Float_t excess = sig-bg;
-  Float_t significance = excess/error;
-  
-  cout << "Excess:       " << excess << endl;
-  cout << "Significance: " << significance << endl;
-  
-  array[0] = excess;
-  array[1] = significance;
-}
-
-
-
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/signalPoint.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/signalPoint.C	(revision 6486)
+++ 	(revision )
@@ -1,131 +1,0 @@
-/////////////////////////////////////////////////////////////////////////////
-//
-//       This macro makes the alpha-plot for one of the positions of the 
-//     False Source Method:
-//
-//                 Ester Aliu   <aliu@ifae.es>
-//                 Oscar Blanch <blanch@ifae.es>
-//                 Javier Rico  <jrico@ifae.es>
-////////////////////////////////////////////////////////////////////////////
-
-void signalPoint(Int_t i=0, Int_t j=0, TString fname="hillasCrab/falseSourceCrab20040215.root")
-{  
-  // constants
-  const Int_t nbins = 18;
-  
-  // general settings
-  gROOT->Reset();
-  gStyle->SetCanvasColor(0);
-  gStyle->SetCanvasBorderMode(0);
-  gStyle->SetPadBorderMode(0);
-  gStyle->SetFrameBorderMode(0);
-  gStyle->SetOptTitle(0);
-  gStyle->SetTitleOffset(1.7,"y");
-  gStyle->SetPadLeftMargin(0.15);
-  gStyle->SetOptStat(111110);
-  gStyle->SetStatColor(0);
-  gStyle->SetStatBorderSize(1);
-  gStyle->SetStatW(0.2);
-  gStyle->SetStatH(0.1);
-  gStyle->SetStatX(0.9);
-  gStyle->SetStatY(0.9);
-  
-  
-  //  open file and access to the histograms
-  TFile *f = new TFile(fname);
-  
-  Char_t name[20]; 
-  Char_t title[50]; 
-  
-  sprintf(name,"hOnAlpha[%d][%d]", i, j);
-  sprintf(title,"Alpha-Plot(On data) (%d ,%d)", i, j);
-  TH1F* onhisto = (TH1F*)gDirectory->Get(name);   
-  
-  sprintf(name,"hOffAlpha[%d][%d]", i, j);
-  sprintf(title,"Alpha-Plot(Off data) (%d ,%d)", i, j);
-  TH1F* offhisto = (TH1F*)gDirectory->Get(name);   
-
-  TPostScript myps("signalpoint.ps",111);
-  myps.Range(15,15);
-  TCanvas *c1 = new TCanvas("c1","c1",800,600);
-  c1->cd(1);
-
-  // line/normalization
-  const Int_t inibin = 20./90.*nbins+1;
-  Float_t level=0;
-  Float_t leveloff=0;
-  Float_t levelofferror=0;
-  for(Int_t ibin = inibin; ibin<=nbins;ibin++)
-    {
-      level+=onhisto->GetBinContent(ibin);
-      leveloff+=offhisto->GetBinContent(ibin);
-    }
-  level/=(nbins-inibin+1);
-  leveloff/=(nbins-inibin+1);
-  
-  // normalize on/off
-  offhisto->Sumw2(); // needed to compute correct errors after normalization
-  const Float_t norm = level/leveloff;
-  cout << "Normalizing by factor " << norm <<endl;
-  offhisto->Scale(norm);    
-  
-  // significance:
-  Float_t sig=0,bg=0,esig=0,ebg=0;
-  Float_t significance=0;
-  const Int_t signbins = inibin-1;
-  for(Int_t ibin = 1; ibin<=signbins;ibin++)
-    {
-      //	Float_t sigma = (onhisto->GetBinContent(ibin)-level)/onhisto->GetBinError(ibin);
-      //	significance+=sigma*sigma;
-      sig  += onhisto->GetBinContent(ibin);
-      esig += onhisto->GetBinError(ibin)*onhisto->GetBinError(ibin);
-      bg   += offhisto->GetBinContent(ibin);
-      ebg  += offhisto->GetBinError(ibin)*offhisto->GetBinError(ibin);
-    }
-  Float_t error= TMath::Sqrt(esig+ebg);
-  significance = (sig-bg)/error;
-  
-  cout << "Significance: " << significance << endl;
-  
-  // plot
-  onhisto->SetXTitle("alpha (deg)");
-  onhisto->SetYTitle("Entries");
-  onhisto->SetMarkerColor(4);
-  onhisto->SetMarkerStyle(20);
-  onhisto->SetMarkerSize(.7);
-  onhisto->SetLineColor(4);
-  onhisto->SetMaximum(onhisto->GetBinContent(nbins)*1.5);
-  
-  offhisto->SetFillColor(2);
-  offhisto->SetMaximum(offhisto->GetBinContent(nbins)*1.5);
-  offhisto->SetXTitle("alpha (deg)");
-  offhisto->SetYTitle("Entries");
-  
-  offhisto->Draw("HIST");
-  offhisto->Draw("ESAME");
-  onhisto->Draw("ESAMES");
-  //    onhisto->Draw("E");
-  
-  // move stat box to make them all visible
-  gPad->Update();
-  TPaveStats* offpavstat = (TPaveStats*) offhisto->GetListOfFunctions()->FindObject("stats");
-  if(offpavstat)
-    {
-      Float_t shiftx = offpavstat->GetX2NDC()-offpavstat->GetX1NDC();
-      offpavstat->SetX1NDC(offpavstat->GetX1NDC()-shiftx);
-      offpavstat->SetX2NDC(offpavstat->GetX2NDC()-shiftx);
-    }
-  
-  // draw line
-  TLine* line = new TLine(0.,level,90.,level);
-  line->SetLineColor(2);
-  line->SetLineStyle(2);
-  //    line->Draw();
-  
-  gPad->Modified();
-  gPad->Update();
-  
-  myps.Close();
-}
-
-
