MeuPlots Class Reference

#include <MeuPlots.h>

List of all members.

Public Member Functions

 MeuPlots ()
 ~MeuPlots ()
void FNALSep04 ()
void MeuSystematics ()
void MakeValidationPlots ()
void ugliClearFibre ()
void CalAttenSyst ()
void CalibrationGroupEnergyCorrections (Float_t &x, const MeuSummary &s) const
void DriftCalibrate (Float_t &x, const MeuSummary &s) const
void DriftDecalTwice (Float_t &x, const MeuSummary &s) const
void EpochTo1995 (std::vector< Double_t > &t) const
void EpochTo1995 (Int_t &t) const
TGraph * TGraphMap (const std::map< Int_t, Float_t > &m) const
TGraph * TGraphVect (std::vector< Double_t > &vX, std::vector< Double_t > &vY) const
void TGraphMinMax (std::vector< TGraph * > &v) const
void TGraphOffset (std::vector< TGraph * > &v, Double_t factor=1) const
void TH1FFill (TH1F *h, std::vector< Double_t > &vX) const
void TProfileFill (TProfile *p, std::vector< Double_t > &vX, std::vector< Double_t > &vY) const
void TProfile2DFill (TProfile2D *p, std::vector< Double_t > &vX, std::vector< Double_t > &vY, std::vector< Double_t > &vZ) const
Int_t Rnd (Double_t x) const
void SetGraphAxis (TAxis *a, Int_t startTimeSecs, Int_t endTimeSecs) const
void SetGraphAxisEtc (TGraph *g, Int_t startTimeSecs, Int_t endTimeSecs) const
void WriteOutHistos () const

Static Public Member Functions

static void InputFileName (std::string f)

Private Member Functions

void InitialiseLoopVariables ()
void InitialiseHitInfoVariables ()
void MakeChain ()
void SetLoopVariables (Int_t entry, Int_t printMode=1)
void SetRootFileObjects ()
std::vector< std::string > MakeFileList ()
void FlipVector (std::vector< Double_t > &v) const
void NormaliseVector (std::vector< Double_t > &v, Int_t mode=1) const
TFile * OpenFile (Int_t runNumber, std::string prefix="")
void ScaleMap (std::map< Int_t, Float_t > &m, const std::map< Int_t, Float_t > &scaleFactor) const
void ScaleVector (std::vector< Double_t > &v, Double_t scaleFactor) const

Private Attributes

Int_t fEntries
Int_t fRunNumber
TFile * fOutFile
TChain * fChain
MeuSummaryfMeuSummary
std::string fS

Static Private Attributes

static std::string fInputFileName = ""

Detailed Description

Definition at line 28 of file MeuPlots.h.


Constructor & Destructor Documentation

MeuPlots::MeuPlots (  ) 

Definition at line 52 of file MeuPlots.cxx.

References fChain, fEntries, fMeuSummary, fOutFile, fRunNumber, fS, Msg::kInfo, MakeChain(), MSG, and SetRootFileObjects().

00053 {
00054   MSG("MeuPlots",Msg::kInfo)
00055     <<"Running MeuPlots Constructor..."<<endl;
00056 
00057   fEntries=0;
00058   fRunNumber=100;
00059   fMeuSummary=0;//pointer to tree in input file
00060   fOutFile=0;//initialise output file pointer
00061   fChain=0;
00062   fS="";//general purpose string
00063 
00064   std::string fS;//general purpose string
00065 
00066   this->MakeChain();
00067   this->SetRootFileObjects();
00068 
00069   //setup some root stuff
00070   //include the under and overflow counts
00071   gStyle->SetOptStat(1111111);
00072   gStyle->SetOptFit(1111);
00073   gStyle->SetPalette(1,(Int_t*)0);
00074 
00075   MSG("MeuPlots",Msg::kInfo)
00076     <<"Finished MeuPlots Constructor"<<endl;
00077 }

MeuPlots::~MeuPlots (  ) 

Definition at line 81 of file MeuPlots.cxx.

References fOutFile, Msg::kDebug, Msg::kInfo, and MSG.

00082 {
00083   MSG("MeuPlots",Msg::kInfo)
00084     <<"Running MeuPlots Destructor..."<<endl;
00085   
00086   if (fOutFile){
00087     //this makes histos disappear from the canvases 
00088     //so do it at the very end
00089     fOutFile->Close();
00090   }
00091 
00092   MSG("MeuPlots",Msg::kDebug)
00093     <<"Finished MeuPlots Destructor"<<endl;
00094 }


Member Function Documentation

void MeuPlots::CalAttenSyst (  ) 

Definition at line 2589 of file MeuPlots.cxx.

References Calibrator::GetAttenCorrectedTpos(), Calibrator::Instance(), SimFlag::kData, StripEnd::kEast, Detector::kFar, StripEnd::kWest, VldContext::Print(), CalScheme::Reset(), CfgPromptConfigurable::Set(), and PlexPlaneId::SetPlane().

02590 {
02591   Calibrator& cal=Calibrator::Instance();
02592 
02593   //Turn them all off (except AttenCalibrator) 
02594   //to save loading the tables.
02595   cal.Set("TimeCalibrator=SimpleCalScheme");
02596   cal.Set("PeCalibrator=SimpleCalScheme");
02597   cal.Set("VALinCalibrator=SimpleCalScheme");
02598   cal.Set("DriftCalibrator=SimpleCalScheme");
02599   cal.Set("LinCalibrator=SimpleCalScheme");
02600   cal.Set("StripCalibrator=SimpleCalScheme");
02601   cal.Set("MIPCalibrator=SimpleCalScheme");
02602   cal.Set("Thermometer=SimpleCalScheme");
02603   //cal.Set("AttenCalibrator=StripAttenCalScheme");//default
02604 
02605   //cal.PrintConfig();
02606 
02607   //test values
02608   Detector::Detector_t dt=Detector::kFar;
02609   //Detector::Detector_t dt=Detector::kNear;
02610   VldTimeStamp* vldts=new VldTimeStamp(2004,11,14,0,0,1);
02611   VldContext* vc=new VldContext(dt,SimFlag::kData,*vldts);
02612   cal.Reset(*vc);
02613   
02614   cout<<"Using VldContext: ";
02615   vc->Print();
02616   cout<<endl;
02617 
02618   Int_t numBins=20;
02619   TProfile* p1=new TProfile("p1","p1",numBins,-4,4);
02620   TProfile* p2=new TProfile("p2","p2",numBins,-4,4);
02621 
02622   TProfile* pSigMap1=new TProfile("pSigMap1","pSigMap1",numBins,-4,4);
02623   TProfile* pSigMap2=new TProfile("pSigMap2","pSigMap2",numBins,-4,4);
02624 
02625   TProfile* pn1=new TProfile("pn1","pn1",numBins,-4,4);
02626   TProfile* pn2=new TProfile("pn2","pn2",numBins,-4,4);
02627 
02628   //have a look at sigmap numbers
02629   Int_t plane=4;//even=U-view=2 in SM1 (even=V-view=3 in SM2)
02630   //Int_t strip=88;
02631   Int_t strip=75;
02632   PlexStripEndId seid1(dt,plane,strip,StripEnd::kEast);
02633   PlexStripEndId seid2(dt,plane,strip,StripEnd::kWest);
02634   Float_t sigcorr=1000;
02635   for (Int_t pl=1;pl<249;pl+=2){
02636     for (Float_t lpos=-4+(8./numBins)/2;lpos<4;lpos+=(8./numBins)){
02637       
02638       seid1.SetPlane(pl);
02639       seid2.SetPlane(pl);
02640 
02641       Float_t sigMap1=cal.GetAttenCorrectedTpos(sigcorr,lpos,seid1);
02642       Float_t sigMap2=cal.GetAttenCorrectedTpos(sigcorr,lpos,seid2);
02643 
02644       //now consider what the response to a fixed energy deposition is
02645       Float_t resp1=sigcorr/sigMap1;
02646       Float_t resp2=sigcorr/sigMap2;
02647 
02648       cout<<"pl="<<pl<<", lpos="<<lpos<<", sigMap1="<<sigMap1
02649           <<", sigMap2="<<sigMap2
02650           <<", resp1="<<resp1
02651           <<", resp2="<<resp2<<endl;
02652       
02653       pSigMap1->Fill(lpos,sigMap1);
02654       pSigMap2->Fill(lpos,sigMap2);
02655 
02656       p1->Fill(lpos,resp1);
02657       p2->Fill(lpos,resp2);
02658     }
02659   }
02660 
02661   for (Int_t pl=1;pl<249;pl+=2){
02662     Int_t i=0;
02663     for (Float_t lpos=-4+(8./numBins)/2;lpos<4;lpos+=(8./numBins)){
02664       i++;
02665       
02666       seid1.SetPlane(pl);
02667       seid2.SetPlane(pl);
02668 
02669       Float_t sigMap1=cal.GetAttenCorrectedTpos(sigcorr,lpos,seid1);
02670       Float_t sigMap2=cal.GetAttenCorrectedTpos(sigcorr,lpos,seid2);
02671 
02672       //now consider what the response to a fixed energy deposition is
02673       Float_t resp1=sigcorr/sigMap1;
02674       Float_t resp2=sigcorr/sigMap2;
02675 
02676       cout<<"pl="<<pl<<", lpos="<<lpos<<", sigMap1="<<sigMap1
02677           <<", sigMap2="<<sigMap2
02678           <<", resp1="<<resp1
02679           <<", resp2="<<resp2<<endl;
02680       
02681       Float_t norm1=resp1/p1->GetBinContent(i);
02682       Float_t norm2=resp2/p2->GetBinContent(i);
02683 
02684       pn1->Fill(lpos,norm1);
02685       pn2->Fill(lpos,norm2);
02686     }
02687   }
02688   
02689   TCanvas* cStripAtten=new TCanvas("cStripAtten","cStripAtten",
02690                                    0,0,700,800);
02691   cStripAtten->SetFillColor(0);
02692   cStripAtten->Divide(2,2);
02693   cStripAtten->cd(1);
02694   p1->Draw("rms");
02695   cStripAtten->cd(2);
02696   p2->Draw("rms");
02697   cStripAtten->cd(3);
02698   pn1->Draw("rms");
02699   pn1->SetTitle("RMS of Normalised Strip Response (end 1)");
02700   //pSigMap1->Draw();
02701   cStripAtten->cd(4);
02702   pn2->Draw();
02703   pn2->SetErrorOption("rms");
02704   pn2->SetTitle("RMS of Normalised Strip Response (end 2)");
02705   //pSigMap2->Draw("rms");
02706 
02707 }

void MeuPlots::CalibrationGroupEnergyCorrections ( Float_t &  x,
const MeuSummary s 
) const

interface to the calibration group's fudge factor

Definition at line 2561 of file MeuPlots.cxx.

References EnergyCorrections::CalibrationGroupEnergyCorrections(), MeuSummary::Detector, VldContext::Print(), MeuSummary::ReleaseType, MeuSummary::SimFlag, and MeuSummary::TimeSec.

Referenced by MakeValidationPlots().

02562 {
02564 
02565   Detector::Detector_t dt=static_cast<Detector::Detector_t>
02566     (s.Detector);
02567   SimFlag::SimFlag_t sf=static_cast<SimFlag::SimFlag_t>
02568     (s.SimFlag);
02569   VldTimeStamp vldts(s.TimeSec);
02570   VldContext vc(dt,sf,vldts);
02571   
02572   static Bool_t firstTime=true;
02573   if (firstTime){
02574     firstTime=false;
02575     
02576     cout<<"MeuPlots::CalibrationGroupEnergyCorrections:"
02577         <<" Using VldContext: ";
02578     vc.Print();
02579     cout<<endl; 
02580   }
02581   
02582   //call the calibration groups energy correction
02583   x=EnergyCorrections::CalibrationGroupEnergyCorrections(x,vc,
02584                                                          s.ReleaseType);
02585 }

void MeuPlots::DriftCalibrate ( Float_t &  x,
const MeuSummary s 
) const

Definition at line 2489 of file MeuPlots.cxx.

References MeuSummary::Detector, Calibrator::GetDriftCorrected(), Calibrator::Instance(), StripEnd::kWest, VldContext::Print(), CalScheme::Reset(), MeuSummary::SimFlag, and MeuSummary::TimeSec.

Referenced by MakeValidationPlots().

02490 {
02491   Calibrator& cal=Calibrator::Instance();
02492 
02493   Detector::Detector_t dt=static_cast<Detector::Detector_t>
02494     (s.Detector);
02495   SimFlag::SimFlag_t sf=static_cast<SimFlag::SimFlag_t>
02496     (s.SimFlag);
02497   VldTimeStamp vldts(s.TimeSec);
02498   VldContext vc(dt,sf,vldts);
02499   
02500   static Bool_t firstTime=true;
02501   if (firstTime){
02502     firstTime=false;
02503 
02504     cout<<"DriftCalibrate: Using VldContext: ";
02505     vc.Print();
02506     cout<<endl; 
02507 
02508     //cal.PrintConfig(cout);
02509   }
02510 
02511   //reset the calibrator vc
02512   cal.Reset(vc);
02513 
02514   //this is just a dummy, it is not used by 
02515   //MuonDriftCalScheme::GetDriftCorrected
02516   PlexStripEndId seid2(dt,100,25,StripEnd::kWest);
02517 
02518   //apply the drift correction
02519   x=cal.GetDriftCorrected(x,seid2);
02520 }

void MeuPlots::DriftDecalTwice ( Float_t &  x,
const MeuSummary s 
) const

Definition at line 2524 of file MeuPlots.cxx.

References Calibrator::DecalDrift(), MeuSummary::Detector, Calibrator::Instance(), StripEnd::kWest, VldContext::Print(), CalScheme::Reset(), MeuSummary::SimFlag, and MeuSummary::TimeSec.

02525 {
02526   Calibrator& cal=Calibrator::Instance();
02527   
02528   Detector::Detector_t dt=static_cast<Detector::Detector_t>
02529     (s.Detector);
02530   SimFlag::SimFlag_t sf=static_cast<SimFlag::SimFlag_t>
02531     (s.SimFlag);
02532   VldTimeStamp vldts(s.TimeSec);
02533   VldContext vc(dt,sf,vldts);
02534   
02535   static Bool_t firstTime=true;
02536   if (firstTime){
02537     firstTime=false;
02538 
02539     cout<<"DriftDecalTwice: Using VldContext: ";
02540     vc.Print();
02541     cout<<endl; 
02542 
02543     //cal.PrintConfig(cout);
02544   }
02545 
02546   //reset the calibrator vc
02547   cal.Reset(vc);
02548 
02549   //this is just a dummy, it is not used by 
02550   //MuonDriftCalScheme::GetDriftCorrected
02551   PlexStripEndId seid2(dt,100,25,StripEnd::kWest);
02552 
02553   //apply it twice
02554   x=cal.DecalDrift(x,seid2);
02555   x=cal.DecalDrift(x,seid2);
02556 }

void MeuPlots::EpochTo1995 ( Int_t &  t  )  const

Definition at line 750 of file MeuPlots.cxx.

00751 {
00752   t-=788918400;// seconds between 1970 and 1995
00753 }

void MeuPlots::EpochTo1995 ( std::vector< Double_t > &  t  )  const

Definition at line 734 of file MeuPlots.cxx.

References Msg::kWarning, and MSG.

Referenced by FNALSep04(), MakeValidationPlots(), and MeuSystematics().

00735 {
00736   if (t.empty()) {
00737     MSG("MeuPlots",Msg::kWarning) 
00738       <<"EpochTo1995: One or more vectors is empty"<<endl;
00739     return;
00740   }
00741 
00742   UInt_t vSize=t.size();
00743   for (UInt_t i=0;i<vSize;i++){
00744     t[i]-=788918400;// seconds between 1970 and 1995
00745   }
00746 }

void MeuPlots::FlipVector ( std::vector< Double_t > &  v  )  const [private]

Definition at line 994 of file MeuPlots.cxx.

References Msg::kDebug, and MSG.

00995 {
00996   MSG("MeuPlots",Msg::kDebug) 
00997     <<" ** Running FlipVector method... **"<<endl;
00998 
00999   vector<Double_t> tempV=v;
01000 
01001   for (UInt_t i=0;i<v.size();i++) v[i]=tempV[v.size()-1-i];
01002 
01003   MSG("MeuPlots",Msg::kDebug) 
01004     <<" ** Finished FlipVector method **"<<endl;
01005 }

void MeuPlots::FNALSep04 (  ) 

Definition at line 1890 of file MeuPlots.cxx.

References EpochTo1995(), fEntries, fOutFile, fS, InitialiseLoopVariables(), Msg::kDebug, Msg::kInfo, MSG, OpenFile(), SetLoopVariables(), MeuSummary::TimeSec, TProfile2DFill(), TProfileFill(), MeuSummary::WinAdc, MeuSummary::WinSigCor, MeuSummary::WinSigLin, MeuSummary::WinSigMap, MeuSummary::WinStopSideLPos, MeuSummary::WinStopSidePl, MeuSummary::WinStopSideTPos, MeuSummary::WinStopSideX, MeuSummary::WinStopSideY, MeuSummary::WinStopSideZ, MeuSummary::WinVtxSideLPos, MeuSummary::WinVtxSidePl, MeuSummary::WinVtxSideStrip, MeuSummary::WinVtxSideTPos, MeuSummary::WinVtxSideView, MeuSummary::WinVtxSideX, MeuSummary::WinVtxSideY, and MeuSummary::WinVtxSideZ.

01891 {
01892   MSG("MeuPlots",Msg::kInfo) 
01893     <<" ** Running FNALSep04 method... **"<<endl;
01894 
01895   //open the output file for the histograms
01896   fOutFile=this->OpenFile(46,"FNALSep04");  
01897 
01898   vector<Double_t> vTimeSec;
01899   vTimeSec.reserve(fEntries);//save lots of actual push backs
01900   Int_t startTimeSecs=2000000000;//2 billion
01901   Int_t endTimeSecs=1;
01902   Int_t div=2;
01903   vector<Double_t> vMeuAdc;
01904   vMeuAdc.reserve(fEntries/div);
01905   vector<Double_t> vMeuSigLin;
01906   vMeuSigLin.reserve(fEntries/div);
01907   vector<Double_t> vMeuSigCor;
01908   vMeuSigCor.reserve(fEntries/div);
01909   vector<Double_t> vMeuSigCorNoCut;
01910   vMeuSigCorNoCut.reserve(fEntries/div);
01911   vector<Double_t> vMeuSigMap;
01912   vMeuSigMap.reserve(fEntries/div);
01913   vector<Double_t> vMeuSigMapNoCut;
01914   vMeuSigMapNoCut.reserve(fEntries/div);
01915   vector<Double_t> vWinPl;
01916   vWinPl.reserve(fEntries/div);
01917 
01918   //window at the vtx end
01919   //vector<Double_t> vWinVtxSidePl;
01920   //vWinVtxSidePl.reserve(fEntries);
01921   vector<Double_t> vMeuV2;
01922   vMeuV2.reserve(fEntries/div);
01923   vector<Double_t> vMeuAdcV2;
01924   vMeuAdcV2.reserve(fEntries/div);
01925   vector<Double_t> vMeuSigCorV2;
01926   vMeuSigCorV2.reserve(fEntries/div);
01927   vector<Double_t> vMeuSigMapV2;
01928   vMeuSigMapV2.reserve(fEntries/div);
01929   vector<Double_t> vWinVtxSideTPosV2;
01930   vWinVtxSideTPosV2.reserve(fEntries/div);
01931   vector<Double_t> vWinVtxSideLPosV2;
01932   vWinVtxSideLPosV2.reserve(fEntries/div);
01933   vector<Double_t> vWinVtxSideStripV2;
01934   vWinVtxSideStripV2.reserve(fEntries/div);
01935   vector<Double_t> vMeuV3;
01936   vMeuV3.reserve(fEntries/div);
01937   vector<Double_t> vWinVtxSideTPosV3;
01938   vWinVtxSideTPosV3.reserve(fEntries/div);
01939   vector<Double_t> vWinVtxSideLPosV3;
01940   vWinVtxSideLPosV3.reserve(fEntries/div);
01941   vector<Double_t> vWinVtxSideStripV3;
01942   vWinVtxSideStripV3.reserve(fEntries/div);
01943   
01944   vector<Double_t> vMeuYvsX;
01945   vMeuYvsX.reserve(fEntries/div);
01946   vector<Double_t> vMeuAdcYvsX;
01947   vMeuAdcYvsX.reserve(fEntries/div);
01948   vector<Double_t> vMeuSigCorYvsX;
01949   vMeuSigCorYvsX.reserve(fEntries/div);
01950   vector<Double_t> vMeuSigMapYvsX;
01951   vMeuSigMapYvsX.reserve(fEntries/div);
01952   vector<Double_t> vWinVtxSideX;
01953   vWinVtxSideX.reserve(fEntries/div);
01954   vector<Double_t> vWinVtxSideY;
01955   vWinVtxSideY.reserve(fEntries/div);
01956   vector<Double_t> vWinMiddleX;
01957   vWinMiddleX.reserve(fEntries/div);
01958   vector<Double_t> vWinMiddleY;
01959   vWinMiddleY.reserve(fEntries/div);
01960   //vector<Double_t> vWinVtxSideZ;
01961   //vWinVtxSideZ.reserve(fEntries);
01962   //vector<Double_t> vWinVtxSideStrip;
01963   //vWinVtxSideStrip.reserve(fEntries);
01964 
01965   //window at the stopping end
01966   //vector<Double_t> vWinStopSidePl;
01967   //vWinStopSidePl.reserve(fEntries);
01968   //vector<Double_t> vWinStopSideView;
01969   //vWinStopSideView.reserve(fEntries);
01970   vector<Double_t> vWinStopSideX;
01971   vWinStopSideX.reserve(fEntries/div);
01972   vector<Double_t> vWinStopSideY;
01973   vWinStopSideY.reserve(fEntries/div);
01974   //vector<Double_t> vWinStopSideZ;
01975   //vWinStopSideZ.reserve(fEntries);
01976   //vector<Double_t> vWinStopSideTPos;
01977   //vWinStopSideTPos.reserve(fEntries);
01978   //vector<Double_t> vWinStopSideLPos;
01979   //vWinStopSideLPos.reserve(fEntries);
01980   //vector<Double_t> vWinStopSideStrip;
01981   //vWinStopSideStrip.reserve(fEntries);
01982   
01983   vector<Double_t> vWinCosThetaY;
01984   vWinCosThetaY.reserve(fEntries/div);
01985   vector<Double_t> vWinCosThetaZ;
01986   vWinCosThetaZ.reserve(fEntries/div);
01987 
01988   Int_t maxMeu=20000;
01989   Int_t meuBinSize=20;
01990   Int_t numMeuBins=maxMeu/meuBinSize;
01991   TH1F* hSigMap=new TH1F("hSigMap","hSigMap",numMeuBins,-1,maxMeu);
01992   hSigMap->SetFillColor(0);
01993   hSigMap->SetTitle("MEU in SigMap Units");
01994   hSigMap->GetXaxis()->SetTitle("MEU");
01995   hSigMap->GetXaxis()->CenterTitle();
01996 
01997   TH1F* hSigMapHack=new TH1F("hSigMapHack","hSigMapHack",numMeuBins,-1,maxMeu);
01998   hSigMapHack->SetFillColor(0);
01999   hSigMapHack->SetTitle("MEU in SigMap Units");
02000   hSigMapHack->GetXaxis()->SetTitle("MEU");
02001   hSigMapHack->GetXaxis()->CenterTitle();
02002   
02003   TProfile* pMeuVsCut=new TProfile("pMeuVsCut","pMeuVsCut",
02004                                    numMeuBins,0,maxMeu);
02005   pMeuVsCut->SetTitle("Average MEU in SigMap Units vs MEU Cut");
02006   pMeuVsCut->GetXaxis()->SetTitle("Cut on MEU");
02007   pMeuVsCut->GetXaxis()->CenterTitle();
02008   pMeuVsCut->GetYaxis()->SetTitle("Average MEU");
02009   pMeuVsCut->GetYaxis()->CenterTitle();
02010 
02011   TProfile* pMeuVsCutNorm=new TProfile("pMeuVsCutNorm","pMeuVsCutNorm",
02012                                        numMeuBins,0,maxMeu);
02013   pMeuVsCutNorm->SetTitle("Average MEU in SigMap Units vs MEU Cut");
02014   pMeuVsCutNorm->GetXaxis()->SetTitle("Cut on MEU");
02015   pMeuVsCutNorm->GetXaxis()->CenterTitle();
02016   pMeuVsCutNorm->GetYaxis()->SetTitle("Average MEU");
02017   pMeuVsCutNorm->GetYaxis()->CenterTitle();
02018 
02019   TH1F* hThetaY=new TH1F("hThetaY","hThetaY",100,-1,1);
02020   hThetaY->SetFillColor(0);
02021   hThetaY->SetTitle("Cos(#theta_{Y})");
02022   hThetaY->GetXaxis()->SetTitle("Cos(#theta_{Y})");
02023   hThetaY->GetXaxis()->CenterTitle();
02024 
02025   TH1F* hThetaZ=new TH1F("hThetaZ","hThetaZ",100,-1,1);
02026   hThetaZ->SetFillColor(0);
02027   hThetaZ->SetTitle("Cos(#theta_{Z})");
02028   hThetaZ->GetXaxis()->SetTitle("Cos(#theta_{Z})");
02029   hThetaZ->GetXaxis()->CenterTitle();
02030 
02031   TH1F* hWinPl=new TH1F("hWinPl","hWinPl",243,0,485);
02032   hWinPl->SetTitle("Track Window Position in Detector");
02033   hWinPl->GetXaxis()->SetTitle("Plane");
02034   hWinPl->GetXaxis()->CenterTitle();
02035   hWinPl->GetYaxis()->SetTitle("");
02036   hWinPl->GetYaxis()->CenterTitle();
02037   hWinPl->SetLineColor(2);
02038   hWinPl->SetFillColor(0);
02039   //hWinPl->SetBit(TH1::kCanRebin);
02040 
02041   TH2F* hYvsXWinVtxSide=new TH2F("hYvsXWinVtxSide","hYvsXWinVtxSide",
02042                                  60,-4,4,60,-4,4);
02043   hYvsXWinVtxSide->SetTitle("Track Window Position (Muon-Entry Side)");
02044   hYvsXWinVtxSide->GetXaxis()->SetTitle("X (m)");
02045   hYvsXWinVtxSide->GetXaxis()->CenterTitle();
02046   hYvsXWinVtxSide->GetYaxis()->SetTitle("Y (m)");
02047   hYvsXWinVtxSide->GetYaxis()->CenterTitle();
02048   hYvsXWinVtxSide->SetLineColor(2);
02049   hYvsXWinVtxSide->SetFillColor(0);
02050   //hYvsXWinVtxSide->SetBit(TH1::kCanRebin);
02051 
02052   TH2F* hYvsXWinStopSide=new TH2F("hYvsXWinStopSide","hYvsXWinStopSide",
02053                                   60,-4,4,60,-4,4);
02054   hYvsXWinStopSide->SetTitle("Track Window Position (Muon-Stop Side)");
02055   hYvsXWinStopSide->GetXaxis()->SetTitle("X (m)");
02056   hYvsXWinStopSide->GetXaxis()->CenterTitle();
02057   hYvsXWinStopSide->GetYaxis()->SetTitle("Y (m)");
02058   hYvsXWinStopSide->GetYaxis()->CenterTitle();
02059   hYvsXWinStopSide->SetLineColor(2);
02060   hYvsXWinStopSide->SetFillColor(0);
02061   //hYvsXWinStopSide->SetBit(TH1::kCanRebin);
02062 
02063   string sCalType="";
02064 
02068   
02069   this->InitialiseLoopVariables();  
02070   
02071   for(Int_t entry=0;entry<fEntries;entry++){
02072     
02073     this->SetLoopVariables(entry);
02074 
02075     MeuSummary& t=(*fMeuSummary);
02076 
02077     //if there was a good window
02078     if (t.WinSigMap>0){
02079 
02080       //get the brem cut variables
02081       vMeuSigMapNoCut.push_back(t.WinSigMap);
02082       vMeuSigCorNoCut.push_back(t.WinSigCor);
02083       hSigMap->Fill(t.WinSigMap);
02084       hSigMapHack->Fill(1.037*t.WinSigMap);
02085 
02086       if (t.WinSigMap>200 && t.WinSigMap<1800){//was 238 1700
02087 
02088         Float_t enDep=t.WinSigMap;
02089         sCalType="SigMap";
02090         
02091         Int_t evTime=t.TimeSec;
02092         vTimeSec.push_back(evTime);
02093         vMeuAdc.push_back(t.WinAdc);
02094         vMeuSigLin.push_back(t.WinSigLin);
02095         vMeuSigCor.push_back(t.WinSigCor);
02096         vMeuSigMap.push_back(t.WinSigMap);
02097 
02098         //get the min and max times
02099         if (evTime>endTimeSecs) endTimeSecs=evTime;
02100         if (evTime<startTimeSecs && evTime>0) startTimeSecs=evTime;
02101         if (evTime<=0) {
02102           cout<<"Bad time="<<evTime<<endl;
02103         }
02104         
02105         //calc the angles
02106         Float_t r2=pow(t.WinVtxSideX-t.WinStopSideX,2)+
02107           pow(t.WinVtxSideY-t.WinStopSideY,2)+
02108           pow(t.WinVtxSideZ-t.WinStopSideZ,2);
02109         Float_t cosThetaY=-2;
02110         Float_t cosThetaZ=-2;
02111         if (r2>0){
02112           Float_t r=sqrt(r2);
02113           cosThetaY=(t.WinVtxSideY-t.WinStopSideY)/r;
02114           cosThetaZ=(t.WinVtxSideZ-t.WinStopSideZ)/r;
02115         }
02116         vWinCosThetaY.push_back(cosThetaY);
02117         vWinCosThetaZ.push_back(cosThetaZ);
02118         hThetaY->Fill(cosThetaY);
02119         hThetaZ->Fill(cosThetaZ);
02120 
02121         //find the pl in the middle of the window and fill histo
02122         Int_t pl=t.WinStopSidePl;
02123         if (t.WinVtxSidePl<t.WinStopSidePl) pl=t.WinVtxSidePl;
02124         pl+=abs(t.WinVtxSidePl-t.WinStopSidePl)/2;
02125         hWinPl->Fill(pl);
02126         vWinPl.push_back(pl);
02127 
02128         //fill the xy plots
02129         if (t.WinVtxSideX>-99 && t.WinVtxSideY>-99 &&
02130             t.WinStopSideX>-99 && t.WinStopSideY>-99){
02131           vMeuYvsX.push_back(enDep);
02132           vMeuAdcYvsX.push_back(t.WinAdc);
02133           vMeuSigCorYvsX.push_back(t.WinSigCor);
02134           vMeuSigMapYvsX.push_back(t.WinSigMap);
02135           vWinVtxSideX.push_back(t.WinVtxSideX);
02136           vWinVtxSideY.push_back(t.WinVtxSideY);
02137           vWinStopSideX.push_back(t.WinStopSideX);
02138           vWinStopSideY.push_back(t.WinStopSideY);
02139           hYvsXWinVtxSide->Fill(t.WinVtxSideX,t.WinVtxSideY);
02140           hYvsXWinStopSide->Fill(t.WinStopSideX,t.WinStopSideY);
02141 
02142           //vWinMiddleX.push_back();
02143           //vWinMiddleY.push_back();
02144         }
02145         else{
02146           MSG("MeuPlots",Msg::kDebug)
02147             <<"Crazy X and Y positions:"<<endl
02148             <<"  WinVtxSide: x="<<t.WinVtxSideX<<", y="<<t.WinVtxSideY
02149             <<endl
02150             <<"  WinStopSide: x="<<t.WinStopSideX<<", y="<<t.WinStopSideY
02151             <<endl;
02152         }
02153 
02154         //fill the different views
02155         if (t.WinVtxSideTPos>-99 && t.WinVtxSideLPos>-99 &&
02156             t.WinStopSideTPos>-99 && t.WinStopSideLPos>-99){
02157           if (t.WinVtxSideView==2){
02158             vMeuV2.push_back(enDep);
02159             vMeuAdcV2.push_back(t.WinAdc);
02160             vMeuSigCorV2.push_back(t.WinSigCor);
02161             vMeuSigMapV2.push_back(t.WinSigMap);
02162             vWinVtxSideTPosV2.push_back(t.WinVtxSideTPos);
02163             vWinVtxSideLPosV2.push_back(t.WinVtxSideLPos);
02164             vWinVtxSideStripV2.push_back(t.WinVtxSideStrip);
02165           }
02166           if (t.WinVtxSideView==3){
02167             vMeuV3.push_back(enDep);
02168             vWinVtxSideTPosV3.push_back(t.WinVtxSideTPos);
02169             vWinVtxSideLPosV3.push_back(t.WinVtxSideLPos);
02170             vWinVtxSideStripV3.push_back(t.WinVtxSideStrip);
02171           }
02172         }
02173       }
02174     }
02175   }//end of for                                       
02176   
02180 
02181   MSG("MeuPlots",Msg::kInfo)<<"Finished main loop"<<endl;
02182 
02183   MSG("MeuPlots",Msg::kInfo)
02184     <<"Start time="<<startTimeSecs<<", endTime="<<endTimeSecs<<endl;
02185   //convert the time to epoch starting in 1995
02186   this->EpochTo1995(vTimeSec);
02187   this->EpochTo1995(endTimeSecs);
02188   this->EpochTo1995(startTimeSecs);
02189 
02193   TCanvas *cMeuVsGeom=new TCanvas("cMeuVsGeom","cMeuVsGeom",
02194                                   0,0,1000,600);
02195   cMeuVsGeom->SetFillColor(0);
02196   cMeuVsGeom->Divide(3,1);
02197   cMeuVsGeom->cd(1);
02198   Int_t nPlBins=static_cast<Int_t>((vWinPl.size()/600)+1);
02199   if (nPlBins>486) nPlBins=486;
02200   TProfile* pMeuAdcVsPlane=new TProfile("pMeuAdcVsPlane",
02201                                         "pMeuAdcVsPlane",
02202                                         nPlBins,0,485);
02203   this->TProfileFill(pMeuAdcVsPlane,vWinPl,vMeuAdc);
02204   pMeuAdcVsPlane->Draw();
02205   pMeuAdcVsPlane->SetTitle("MEU in ADCs vs Plane");
02206   pMeuAdcVsPlane->GetXaxis()->SetTitle("Plane");
02207   pMeuAdcVsPlane->GetXaxis()->CenterTitle();
02208   pMeuAdcVsPlane->GetYaxis()->SetTitle("MEU");
02209   pMeuAdcVsPlane->GetYaxis()->CenterTitle();
02210   pMeuAdcVsPlane->SetMinimum(600);
02211   pMeuAdcVsPlane->SetMaximum(1000);
02212   cMeuVsGeom->cd(2);
02213   TProfile* pMeuSigLinVsPlane=new TProfile("pMeuSigLinVsPlane",
02214                                            "pMeuSigLinVsPlane",
02215                                            nPlBins,0,485);
02216   this->TProfileFill(pMeuSigLinVsPlane,vWinPl,vMeuSigLin);
02217   pMeuSigLinVsPlane->Draw();
02218   pMeuSigLinVsPlane->SetTitle("MEU in Gain Corrected ADCs (like PEs) vs Plane");
02219   pMeuSigLinVsPlane->GetXaxis()->SetTitle("Plane");
02220   pMeuSigLinVsPlane->GetXaxis()->CenterTitle();
02221   pMeuSigLinVsPlane->GetYaxis()->SetTitle("MEU");
02222   pMeuSigLinVsPlane->GetYaxis()->CenterTitle();
02223   cMeuVsGeom->cd(3);
02224   TProfile* pMeuSigCorVsPlane=new TProfile("pMeuSigCorVsPlane",
02225                                            "pMeuSigCorVsPlane",
02226                                            nPlBins,0,485);
02227   this->TProfileFill(pMeuSigCorVsPlane,vWinPl,vMeuSigCor);
02228   pMeuSigCorVsPlane->Draw();
02229   pMeuSigCorVsPlane->SetTitle("MEU in Strip to Strip Corrected ADCs (SigCors) vs Plane");
02230   pMeuSigCorVsPlane->GetXaxis()->SetTitle("Plane");
02231   pMeuSigCorVsPlane->GetXaxis()->CenterTitle();
02232   pMeuSigCorVsPlane->GetYaxis()->SetTitle("MEU");
02233   pMeuSigCorVsPlane->GetYaxis()->CenterTitle();
02234 
02238   TCanvas *cYvsX=new TCanvas("cYvsX","cYvsX",0,0,1000,400);
02239   cYvsX->SetFillColor(0);
02240   cYvsX->Divide(3,1);
02241   cYvsX->cd(1);
02242   Int_t nYvsXBins=static_cast<Int_t>((vWinStopSideX.size()/1000)+1);
02243   TProfile2D* pMeuAdcAsYvsX=new TProfile2D("pMeuAdcAsYvsX","pMeuAdcAsYvsX",
02244                                            nYvsXBins,-4,4,nYvsXBins,-4,4);
02245   this->TProfile2DFill(pMeuAdcAsYvsX,vWinStopSideX,vWinStopSideY,
02246                        vMeuAdcYvsX);
02247   pMeuAdcAsYvsX->Draw("colz");
02248   fS="MEU in ADCs";
02249   pMeuAdcAsYvsX->SetTitle(fS.c_str());
02250   pMeuAdcAsYvsX->GetXaxis()->SetTitle("X (m)");
02251   pMeuAdcAsYvsX->GetXaxis()->CenterTitle();
02252   pMeuAdcAsYvsX->GetYaxis()->SetTitle("Y (m)");
02253   pMeuAdcAsYvsX->GetYaxis()->CenterTitle();
02254   pMeuAdcAsYvsX->SetMinimum(600);
02255   pMeuAdcAsYvsX->SetMaximum(1100);
02256   cYvsX->cd(2);
02257   TProfile2D* pMeuSigCorAsYvsX=new TProfile2D("pMeuSigCorAsYvsX","pMeuSigCorAsYvsX",
02258                                               nYvsXBins,-4,4,nYvsXBins,-4,4);
02259   this->TProfile2DFill(pMeuSigCorAsYvsX,vWinStopSideX,vWinStopSideY,
02260                        vMeuSigCorYvsX);
02261   pMeuSigCorAsYvsX->Draw("colz");
02262   fS="MEU in SigCors";
02263   pMeuSigCorAsYvsX->SetTitle(fS.c_str());
02264   pMeuSigCorAsYvsX->GetXaxis()->SetTitle("X (m)");
02265   pMeuSigCorAsYvsX->GetXaxis()->CenterTitle();
02266   pMeuSigCorAsYvsX->GetYaxis()->SetTitle("Y (m)");
02267   pMeuSigCorAsYvsX->GetYaxis()->CenterTitle();
02268   pMeuSigCorAsYvsX->SetMinimum(600);
02269   pMeuSigCorAsYvsX->SetMaximum(1100);
02270   cYvsX->cd(3);
02271   TProfile2D* pMeuSigMapAsYvsX=new TProfile2D("pMeuSigMapAsYvsX","pMeuSigMapAsYvsX",
02272                                               nYvsXBins,-4,4,nYvsXBins,-4,4);
02273   this->TProfile2DFill(pMeuSigMapAsYvsX,vWinStopSideX,vWinStopSideY,
02274                        vMeuSigMapYvsX);
02275   pMeuSigMapAsYvsX->Draw("colz");
02276   fS="MEU in SigMaps";
02277   pMeuSigMapAsYvsX->SetTitle(fS.c_str());
02278   pMeuSigMapAsYvsX->GetXaxis()->SetTitle("X (m)");
02279   pMeuSigMapAsYvsX->GetXaxis()->CenterTitle();
02280   pMeuSigMapAsYvsX->GetYaxis()->SetTitle("Y (m)");
02281   pMeuSigMapAsYvsX->GetYaxis()->CenterTitle();
02282   pMeuSigMapAsYvsX->SetMinimum(600);
02283   pMeuSigMapAsYvsX->SetMaximum(1100);
02284 
02288   TCanvas *cTPos=new TCanvas("cTPos","cTPos",0,0,1000,700);
02289   cTPos->SetFillColor(0);
02290   cTPos->Divide(2,1);
02291   cTPos->cd(1);
02292   Int_t nBinsTPos=static_cast<Int_t>((vWinVtxSideTPosV2.size()/600)+1);
02293   TProfile* pMeuAdcVsTPos=new TProfile("pMeuAdcVsTPos","pMeuAdcVsTPos",
02294                                        nBinsTPos,-4,4); 
02295   this->TProfileFill(pMeuAdcVsTPos,vWinVtxSideTPosV2,vMeuAdcV2);
02296   //pMeuAdcVsTPos->Fit("pol1","q","",-2.5,2.5);
02297   pMeuAdcVsTPos->Draw();
02298   fS="MEU vs TPos (U-View)";
02299   pMeuAdcVsTPos->SetTitle(fS.c_str());
02300   pMeuAdcVsTPos->GetXaxis()->SetTitle("TPos (m)");
02301   pMeuAdcVsTPos->GetXaxis()->CenterTitle();
02302   pMeuAdcVsTPos->GetYaxis()->SetTitle("MEU");
02303   pMeuAdcVsTPos->GetYaxis()->CenterTitle();
02304   pMeuAdcVsTPos->SetMinimum(700);
02305   pMeuAdcVsTPos->SetMaximum(1000);
02306   TProfile* pMeuSigCorVsTPos=new TProfile("pMeuSigCorVsTPos","pMeuSigCorVsTPos",
02307                                           nBinsTPos,-4,4); 
02308   this->TProfileFill(pMeuSigCorVsTPos,vWinVtxSideTPosV2,vMeuSigCorV2);
02309   //pMeuSigCorVsTPos->Fit("pol1","q","",-2.5,2.5);
02310   pMeuAdcVsTPos->Draw();//redraw because of fit
02311   pMeuSigCorVsTPos->Draw("sames");
02312   fS="MEU vs TPos (U-View)";
02313   pMeuSigCorVsTPos->SetTitle(fS.c_str());
02314   pMeuSigCorVsTPos->GetXaxis()->SetTitle("TPos (m)");
02315   pMeuSigCorVsTPos->GetXaxis()->CenterTitle();
02316   pMeuSigCorVsTPos->GetYaxis()->SetTitle("MEU");
02317   pMeuSigCorVsTPos->GetYaxis()->CenterTitle();
02318   pMeuSigCorVsTPos->SetLineColor(2);
02319   pMeuSigCorVsTPos->SetMinimum(700);
02320   pMeuSigCorVsTPos->SetMaximum(1000);
02321   TLegend *lPos=new TLegend(0.3,0.6, 0.6,0.8);
02322   lPos->SetBorderSize(0);
02323   lPos->SetFillColor(0);
02324   lPos->SetTextSize(0.035);
02325   lPos->AddEntry(pMeuAdcVsTPos,"MEU in ADC Units","l");
02326   lPos->AddEntry(pMeuSigCorVsTPos,"MEU in SigCor Units","l");
02327   lPos->Draw();
02329   cTPos->cd(2);
02330   //make another one without fit
02331   TProfile* pMeuSigCorVsTPos2=new TProfile("pMeuSigCorVsTPos2","pMeuSigCorVsTPos2",
02332                                            nBinsTPos,-4,4); 
02333   this->TProfileFill(pMeuSigCorVsTPos2,vWinVtxSideTPosV2,vMeuSigCorV2);
02334   pMeuSigCorVsTPos2->Draw();
02335   fS="MEU vs TPos (U-View)";
02336   pMeuSigCorVsTPos2->SetTitle(fS.c_str());
02337   pMeuSigCorVsTPos2->GetXaxis()->SetTitle("TPos (m)");
02338   pMeuSigCorVsTPos2->GetXaxis()->CenterTitle();
02339   pMeuSigCorVsTPos2->GetYaxis()->SetTitle("MEU");
02340   pMeuSigCorVsTPos2->GetYaxis()->CenterTitle();
02341   pMeuSigCorVsTPos2->SetLineColor(2);
02342   pMeuSigCorVsTPos2->SetMinimum(700);
02343   pMeuSigCorVsTPos2->SetMaximum(1000);
02344   TProfile* pMeuSigMapVsTPos=new TProfile("pMeuSigMapVsTPos","pMeuSigMapVsTPos",
02345                                           nBinsTPos,-4,4); 
02346   this->TProfileFill(pMeuSigMapVsTPos,vWinVtxSideTPosV2,vMeuSigMapV2);
02347   pMeuSigMapVsTPos->Draw("sames");
02348   fS="MEU vs TPos (U-View)";
02349   pMeuSigMapVsTPos->SetTitle(fS.c_str());
02350   pMeuSigMapVsTPos->GetXaxis()->SetTitle("TPos (m)");
02351   pMeuSigMapVsTPos->GetXaxis()->CenterTitle();
02352   pMeuSigMapVsTPos->GetYaxis()->SetTitle("MEU");
02353   pMeuSigMapVsTPos->GetYaxis()->CenterTitle();
02354   pMeuSigMapVsTPos->SetLineColor(4);
02355   pMeuSigMapVsTPos->SetMinimum(700);
02356   pMeuSigMapVsTPos->SetMaximum(1000);
02357   TLegend *lPos2=new TLegend(0.3,0.6, 0.6,0.8);
02358   lPos2->SetBorderSize(0);
02359   lPos2->SetFillColor(0);
02360   lPos2->SetTextSize(0.035);
02361   lPos2->AddEntry(pMeuSigCorVsTPos2,"MEU in SigCor Units","l");
02362   lPos2->AddEntry(pMeuSigMapVsTPos,"MEU in SigMap Units","l");
02363   lPos2->Draw();
02364 
02365   //vMeuAdcV2.push_back(t.WinAdc);
02366   //vMeuSigCorV2.push_back(t.WinSigCor);
02367   //        vMeuSigMapV2.push_back(t.WinSigMap);
02368   //vWinVtxSideTPosV2.push_back(t.WinVtxSideTPos);
02369   //Int_t maxMeu=20000;
02370   //Float_t meuBinSize=20;
02371   //Int_t numMeuBins=maxMeu/binSize;
02372 
02373   Double_t quantile=0.5;//quantile to compute
02374   Double_t medianAll=-1;
02375   hSigMap->GetQuantiles(1,&medianAll,&quantile);
02376   cout<<"medianAll="<<medianAll<<endl;
02377   Double_t meanAll=hSigMap->GetMean();
02378  
02379   multimap<Double_t,Int_t> meu;
02380   //multimap<Int_t,Double_t> meuInv;
02381   Int_t i=0;
02382   cout<<"Starting nested loops..."<<endl;
02383   for (vector<Double_t>::iterator vIt=vMeuSigMapNoCut.begin();
02384        vIt!=vMeuSigMapNoCut.end();++vIt){
02385     meu.insert(pair<Double_t,Int_t>((*vIt),i));
02386     //vMeuSigMapNoCut
02387     for (Float_t meu=0;meu<maxMeu;meu+=meuBinSize){
02388       if ((*vIt)<meu){
02389         pMeuVsCut->Fill(meu,*vIt);
02390         pMeuVsCutNorm->Fill(meu,(*vIt)/meanAll);
02391       }
02392     }
02393     i++;
02394   }
02398   TCanvas *cMeuCut=new TCanvas("cMeuCut","cMeuCut",0,0,1000,700);
02399   cMeuCut->SetFillColor(0);
02400   cMeuCut->Divide(2,2);
02401   cMeuCut->cd(1);
02402   hSigMap->Draw();
02403   cMeuCut->cd(2);
02404   //pMeuVsCut->Draw();
02405   pMeuVsCutNorm->Draw();
02406 
02407   TGraph* gMedian=new TGraph(2);
02408   gMedian->SetName("gMedian");
02409   gMedian->SetMarkerStyle(8);
02410 
02411   Double_t median=-1;
02412   i=0;
02413   Int_t point=0;
02414 
02415   //loop through the sorted container of entries
02416   cout<<"Looping over multimap..."<<endl;
02417   for (multimap<Double_t,Int_t>::iterator vIt=meu.begin();
02418        vIt!=meu.end();++vIt){
02419 
02420     Bool_t useThisOne=true;
02421     
02422     //do some pre-scaling to prentry the graph getting huge
02423     Int_t scaleFactor=10;
02424     if (vIt->first<1000){
02425       if (i%scaleFactor!=0) useThisOne=false;
02426     }
02427 
02428     if (useThisOne){
02429       //only start adding the median to the graph once past a value
02430       if (vIt->first>600){
02431         //static Bool_t first=true;
02432         
02433         //      if (first){
02434         //first=false;
02435         Int_t medianNum=i/2;
02436         //only need to do this once
02437         //for every point above 600 just need to move on by 1/2 a
02438         multimap<Double_t,Int_t>::iterator itMedian=meu.begin();
02439         advance(itMedian,medianNum);
02440         //}
02441         //else {
02442         //need to move on half an iteration each time
02443         //not quite right, but there are so many entries...
02444         //if (i%2==0) ++itMedian;
02445         //}
02446         
02447         median=itMedian->first;
02448         //cout<<"Above cut = "<<vIt->first<<", i="<<i
02449         //  <<", medNum="<<i/2<<", median="<<median<<endl;
02450         gMedian->SetPoint(point,vIt->first,median/medianAll);
02451         point++;
02452       }
02453     }
02454 
02455     i++;
02456   }
02457   
02458   cout<<"Extracting graph from tprof..."<<endl;
02459   TGraph* gMean=new TGraph(pMeuVsCutNorm->GetNbinsX());
02460   gMean->SetName("gMean");
02461   gMean->SetMarkerStyle(8);
02462   gMean->SetMarkerColor(2);
02463   for (Int_t i=0;i<pMeuVsCutNorm->GetNbinsX();i++){
02464     Double_t x=pMeuVsCutNorm->GetBinCenter(i);
02465     Double_t y=pMeuVsCutNorm->GetBinContent(i);
02466     gMean->SetPoint(i,x,y);
02467   }
02468 
02469   cMeuCut->cd(3);
02470   gMedian->SetTitle("Variation of the Mean and the Median with Trunction Threshold");
02471   gMedian->Draw("ap");
02472   gMean->Draw("p");
02473   cMeuCut->cd(4);
02474   hSigMap->Draw();
02475   //1.037
02476 
02477   cout<<"Map size="<<meu.size()<<", vect size="<<vMeuSigMapNoCut.size()
02478       <<", median="<<median<<endl;
02479   
02480   gMedian->Write();
02481   gMean->Write();
02482 
02483   MSG("MeuPlots",Msg::kInfo) 
02484     <<" ** Finished FNALSep04 method **"<<endl;
02485 }

void MeuPlots::InitialiseHitInfoVariables (  )  [private]
void MeuPlots::InitialiseLoopVariables (  )  [private]

Definition at line 98 of file MeuPlots.cxx.

References Msg::kDebug, and MSG.

Referenced by FNALSep04(), MakeValidationPlots(), and MeuSystematics().

00099 {
00100   MSG("MeuPlots",Msg::kDebug)<<"Initialising loop variables..."<<endl;
00101 
00102   MSG("MeuPlots",Msg::kDebug)<<"Initialisation complete"<<endl;
00103 }

static void MeuPlots::InputFileName ( std::string  f  )  [static]
void MeuPlots::MakeChain (  )  [private]

Definition at line 244 of file MeuPlots.cxx.

References exit(), fChain, Msg::kFatal, Msg::kInfo, MakeFileList(), and MSG.

Referenced by MeuPlots().

00245 {
00246   //get the files to open
00247   vector<string> fileList=this->MakeFileList();
00248 
00249   //create a chain with MeuSummary tree
00250   fChain= new TChain("s");
00251   
00252   Int_t nf=0;
00253   //add the files to the chain
00254   for (vector<string>::iterator file=fileList.begin();
00255        file!=fileList.end();++file){
00256     
00257     //test if file already exists
00258     ifstream openOk((*file).c_str()); 
00259 
00260     //check if a wildcard was used because ifstream can't open wildcards
00261     Int_t stars=(*file).find("*");
00262     Int_t quest=(*file).find("?");
00263 
00264     //check if file existed
00265     if (!openOk && !(quest>=0 || stars>=0)){
00266       MSG("MeuPlots",Msg::kInfo)
00267         <<endl<<endl
00268         <<"***********************************************************"
00269         <<endl<<"Can't find file="<<*file<<endl
00270         <<"Note: you can't use '~/'. It has to be the full path"<<endl
00271         <<"***********************************************************"
00272         <<endl<<endl
00273         <<"Exiting here!"<<endl;
00274       exit(0);
00275     }
00276     
00277     MSG("MeuPlots",Msg::kInfo)<<"Adding file="<<*file<<endl;
00278     nf+=fChain->Add((*file).c_str());
00279   }
00280 
00281   if(nf==0){
00282     MSG("MeuPlots",Msg::kFatal)
00283       <<endl<<endl
00284       <<"*************************************************************"
00285       <<endl<<"No MeuSummary*.root files found"<<endl
00286       <<"Please set MEUSUMMARY to the directory containing the"
00287       <<" MeuSummary*.root files"<<endl
00288       <<"Or give the txt file containing the files to be input"<<endl
00289       <<"Note: If more than one file is found they will be"
00290       <<" concatenated in a TChain and treated as one"<<endl
00291       <<"*************************************************************"
00292       <<endl<<endl<<"Program will exit here"<<endl;
00293     exit(0);
00294   }
00295     
00296   MSG("MeuPlots",Msg::kInfo) 
00297     <<"MeuSummary information:"<<endl;
00298   fChain->Show(0);
00299   
00300   MSG("MeuPlots",Msg::kInfo)
00301     <<endl<<"Analysing "<<nf<<" file(s). Reading from disk..."<<endl;
00302 }

vector< string > MeuPlots::MakeFileList (  )  [private]

Check the fInputFileName first then check the env variable

Definition at line 170 of file MeuPlots.cxx.

References exit(), fInputFileName, Msg::kDebug, Msg::kFatal, Msg::kInfo, and MSG.

Referenced by MakeChain().

00171 {
00173 
00174   vector<string> fileList;
00175   
00176   if (fInputFileName!=""){
00177 
00178     Int_t findGives=fInputFileName.find(".root");
00179     cout<<"find gives="<<fInputFileName.find(".root")<<endl;
00180 
00181     if (findGives>0){
00182       //add the file direct to the list
00183       fileList.push_back(fInputFileName);
00184     }
00185     else{//treat the file as a list of root files 
00186       ifstream inputFile(fInputFileName.c_str());
00187       
00188       //check if file exists
00189       if (inputFile){
00190         //variables to hold input from file
00191         string file="";
00192         
00193         //read in from the text file and fill objects
00194         while(inputFile>>file) {
00195           MSG("MeuPlots",Msg::kDebug)
00196             <<"Found input file name="<<file<<endl;
00197           fileList.push_back(file);
00198         }
00199         MSG("MeuPlots",Msg::kDebug)
00200           <<"Files names found in txt file="<<fileList.size()<<endl;
00201       }
00202       else{
00203         MSG("MeuPlots",Msg::kFatal)
00204           <<endl<<endl
00205           <<"***********************************************************"
00206           <<endl<<"Input txt file of file names does not exist!"<<endl
00207           <<"InputFileName="<<fInputFileName<<endl
00208           <<"***********************************************************"
00209           <<endl<<endl<<"Program will exit here"<<endl;
00210         exit(0);
00211       }
00212     }
00213   }
00214   //return the fileList if files were found
00215   if (fileList.size()>0) return fileList;
00216   
00217   //Check the env variable to find files
00218   char* envVariable=getenv("MEUSUMMARY");
00219   if (envVariable==NULL){
00220     MSG("MeuPlots",Msg::kFatal)
00221       <<endl<<endl
00222       <<"*************************************************************"
00223       <<endl<<"Environmental variable MEUSUMMARY not set!"<<endl
00224       <<"Please set MEUSUMMARY to the directory containing the"
00225       <<" MeuSummary*.root files"<<endl
00226       <<"Note: If more than one file is found they will be"
00227       <<" concatenated and treated as one"<<endl
00228       <<"*************************************************************"
00229       <<endl<<endl<<"Program will exit here"<<endl;
00230     exit(0);
00231   }
00232   string sEnv=envVariable;
00233   MSG("MeuPlots",Msg::kInfo)
00234     <<"Looking for MeuSummary*.root files using the env variable"<<endl
00235     <<"MEUSUMMARY="<<sEnv<<endl;
00236   sEnv+="/MeuSummary*.root";
00237   fileList.push_back(sEnv);
00238 
00239   return fileList;
00240 }

void MeuPlots::MakeValidationPlots (  ) 

Definition at line 4100 of file MeuPlots.cxx.

References MeuHitInfo::Adc, MeuHitInfo::Adc1, MeuHitInfo::Adc2, MeuSummary::BusyChips, CalibrationGroupEnergyCorrections(), MeuSummary::ColdChips, MeuSummary::CrateMask, det, MeuSummary::Detector, DriftCalibrate(), MeuSummary::EndPlane, MeuSummary::EndX, MeuSummary::EndY, EpochTo1995(), err(), fEntries, Form(), fOutFile, fRunNumber, MeuSummary::GoodDataQuality, InitialiseLoopVariables(), MeuCuts::IsInPittFidVol(), ReleaseType::kCedar, ReleaseType::kDaikon, Msg::kDebug, Detector::kFar, Msg::kInfo, Detector::kNear, PlaneView::kU, PlaneView::kV, Msg::kVerbose, MeuHitInfo::LPos, MAXMSG, MeuHitInfo::MCEnDep, MeuSummary::MCHighEn, MeuSummary::MCLowEn, MeuSummary::MCParticleId, MeuSummary::MeuHitInfo, MSG, n, OpenFile(), MeuHitInfo::Pe, MeuHitInfo::Pe1, MeuHitInfo::Pe2, MeuHitInfo::Plane, MeuHitInfo::PLCor, MeuSummary::ReleaseType, MeuSummary::Run, ScaleVector(), SetGraphAxis(), SetLoopVariables(), MeuHitInfo::SigCor, MeuHitInfo::SigCor1, MeuHitInfo::SigCor2, MeuHitInfo::SigCorTrk1, MeuHitInfo::SigCorTrk2, MeuHitInfo::SigDrf, MeuHitInfo::SigLin, MeuHitInfo::SigLin1, MeuHitInfo::SigLin2, MeuHitInfo::SigLinOnly, MeuHitInfo::SigMap, MeuHitInfo::SigMap1, MeuHitInfo::SigMap2, MeuSummary::SimFlag, MeuSummary::SM1, MeuSummary::SM2, MeuSummary::Snarl, MeuHitInfo::Strip, MeuSummary::Temperature, TH1FFill(), MeuSummary::TimeSec, MeuSummary::TotalMatTraversed, MeuHitInfo::TPos, TProfileFill(), MeuHitInfo::View, MeuSummary::VtxPlane, MeuSummary::VtxX, MeuSummary::VtxY, MeuSummary::WinAdc, MeuSummary::WinAvCosThetaZ, MeuSummary::WinAvNumDigits, MeuSummary::WinAvNumStrips, MeuSummary::WinPe, MeuSummary::WinSigCor, MeuSummary::WinSigLin, MeuSummary::WinSigMap, MeuSummary::WinStopSidePl, MeuSummary::WinStopSideX, MeuSummary::WinStopSideY, MeuSummary::WinVtxSidePl, MeuSummary::WinVtxSideX, MeuSummary::WinVtxSideY, MeuHitInfo::X, MeuHitInfo::Y, and MeuHitInfo::Z.

04101 {
04102   MSG("MeuPlots",Msg::kInfo) 
04103     <<" ** Running MakeValidationPlots method... **"<<endl;
04104 
04105   //open the output file for the histograms
04106   fOutFile=this->OpenFile(fRunNumber,"MeuPlots");
04107   
04108   //histogram for recording which detector
04109   TH1F* hDetector=new TH1F("hDetector","hDetector",40,-20,20);
04110   TH1F* hSimFlag=new TH1F("hSimFlag","hSimFlag",40,-20,20);
04111 
04112   TH1F* hCrateMask = new TH1F("hCrateMask","hCrateMask",18,-1,17);
04113   TH1F* hBusyChips = new TH1F("hBusyChips","hBusyChips",51,-1,50);
04114   TH1F* hColdChips = new TH1F("hColdChips","hColdChips",21,-1,20);
04115   TH1F* hDataQuality = new TH1F("hDataQuality","hDataQuality",3,-1,2);
04116 
04117   TH1F* hGeVPerMeu=new TH1F("hGeVPerMeu","hGeVPerMeu",3000,-0.001,0.3);
04118   hGeVPerMeu->SetFillColor(0);
04119   hGeVPerMeu->SetTitle("GeV/MEU");
04120   hGeVPerMeu->GetXaxis()->SetTitle("GeV/MEU");
04121   hGeVPerMeu->GetXaxis()->CenterTitle();
04122 
04123   //note the binning here is effectively a threshold
04124   TH1F* hSigMap=new TH1F("hSigMap","hSigMap",3001,-1,3000);
04125   hSigMap->SetFillColor(0);
04126   hSigMap->SetTitle("MEU in SigMap Units");
04127   hSigMap->GetXaxis()->SetTitle("MEU");
04128   hSigMap->GetXaxis()->CenterTitle();
04129   
04130   TH1F* hSigMapNoThresh=new TH1F("hSigMapNoThresh","hSigMapNoThresh",
04131                                  50032,-32,50000);
04132   hSigMapNoThresh->SetFillColor(0);
04133   hSigMapNoThresh->SetTitle("MEU in SigMap Units (High Thresh.)");
04134   hSigMapNoThresh->GetXaxis()->SetTitle("MEU");
04135   hSigMapNoThresh->GetXaxis()->CenterTitle();
04136   
04137   TH1F* hSigMapDriftX=new TH1F("hSigMapDriftX","hSigMapDriftX",
04138                                3001,-1,3000);
04139   hSigMapDriftX->SetFillColor(0);
04140   hSigMapDriftX->SetTitle("MEU in SigMap Units (w/ Drift Fudge)");
04141   hSigMapDriftX->GetXaxis()->SetTitle("MEU");
04142   hSigMapDriftX->GetXaxis()->CenterTitle();
04143 
04144   TH1F* hSigMapWinCor=new TH1F("hSigMapWinCor","hSigMapWinCor",
04145                                3001,-1,3000);
04146   hSigMapWinCor->SetFillColor(0);
04147   hSigMapWinCor->SetTitle("MEU in SigMap Units");
04148   hSigMapWinCor->GetXaxis()->SetTitle("MEU");
04149   hSigMapWinCor->GetXaxis()->CenterTitle();
04150 
04151   TH1F* hSigMapMuPlus=new TH1F("hSigMapMuPlus","hSigMapMuPlus",3001,-1,3000);
04152   hSigMapMuPlus->SetFillColor(0);
04153   hSigMapMuPlus->SetTitle("MEU in SigMap Units");
04154   hSigMapMuPlus->GetXaxis()->SetTitle("MEU");
04155   hSigMapMuPlus->GetXaxis()->CenterTitle();
04156 
04157   TH1F* hSigMapMuMinus=new TH1F("hSigMapMuMinus","hSigMapMuMinus",
04158                                 3001,-1,3000);
04159   hSigMapMuMinus->SetFillColor(0);
04160   hSigMapMuMinus->SetTitle("MEU in SigMap Units");
04161   hSigMapMuMinus->GetXaxis()->SetTitle("MEU");
04162   hSigMapMuMinus->GetXaxis()->CenterTitle();
04163 
04164   //separate stripends
04165   TH1F* hSigMapU1=new TH1F("hSigMapU1","hSigMapU1",3001,-1,3000);
04166   hSigMapU1->SetFillColor(0);
04167   hSigMapU1->SetTitle("MEU in SigMap Units");
04168   hSigMapU1->GetXaxis()->SetTitle("MEU");
04169   hSigMapU1->GetXaxis()->CenterTitle();
04170 
04171   TH1F* hSigMapU2=new TH1F("hSigMapU2","hSigMapU2",3001,-1,3000);
04172   hSigMapU2->SetFillColor(0);
04173   hSigMapU2->SetTitle("MEU in SigMap Units");
04174   hSigMapU2->GetXaxis()->SetTitle("MEU");
04175   hSigMapU2->GetXaxis()->CenterTitle();
04176 
04177   TH1F* hSigMapV1=new TH1F("hSigMapV1","hSigMapV1",3001,-1,3000);
04178   hSigMapV1->SetFillColor(0);
04179   hSigMapV1->SetTitle("MEU in SigMap Units");
04180   hSigMapV1->GetXaxis()->SetTitle("MEU");
04181   hSigMapV1->GetXaxis()->CenterTitle();
04182 
04183   TH1F* hSigMapV2=new TH1F("hSigMapV2","hSigMapV2",3001,-1,3000);
04184   hSigMapV2->SetFillColor(0);
04185   hSigMapV2->SetTitle("MEU in SigMap Units");
04186   hSigMapV2->GetXaxis()->SetTitle("MEU");
04187   hSigMapV2->GetXaxis()->CenterTitle();
04188 
04189   //separate stripends and different SM
04190   //SM1
04191   TH1F* hSigMapSM1U1=new TH1F("hSigMapSM1U1","hSigMapSM1U1",3001,-1,3000);
04192   hSigMapSM1U1->SetFillColor(0);
04193   hSigMapSM1U1->SetTitle("MEU in SigMap Units");
04194   hSigMapSM1U1->GetXaxis()->SetTitle("MEU");
04195   hSigMapSM1U1->GetXaxis()->CenterTitle();
04196 
04197   TH1F* hSigMapSM1U2=new TH1F("hSigMapSM1U2","hSigMapSM1U2",3001,-1,3000);
04198   hSigMapSM1U2->SetFillColor(0);
04199   hSigMapSM1U2->SetTitle("MEU in SigMap Units");
04200   hSigMapSM1U2->GetXaxis()->SetTitle("MEU");
04201   hSigMapSM1U2->GetXaxis()->CenterTitle();
04202 
04203   TH1F* hSigMapSM1V1=new TH1F("hSigMapSM1V1","hSigMapSM1V1",3001,-1,3000);
04204   hSigMapSM1V1->SetFillColor(0);
04205   hSigMapSM1V1->SetTitle("MEU in SigMap Units");
04206   hSigMapSM1V1->GetXaxis()->SetTitle("MEU");
04207   hSigMapSM1V1->GetXaxis()->CenterTitle();
04208 
04209   TH1F* hSigMapSM1V2=new TH1F("hSigMapSM1V2","hSigMapSM1V2",3001,-1,3000);
04210   hSigMapSM1V2->SetFillColor(0);
04211   hSigMapSM1V2->SetTitle("MEU in SigMap Units");
04212   hSigMapSM1V2->GetXaxis()->SetTitle("MEU");
04213   hSigMapSM1V2->GetXaxis()->CenterTitle();
04214 
04215   //SM2
04216   TH1F* hSigMapSM2U1=new TH1F("hSigMapSM2U1","hSigMapSM2U1",3001,-1,3000);
04217   hSigMapSM2U1->SetFillColor(0);
04218   hSigMapSM2U1->SetTitle("MEU in SigMap Units");
04219   hSigMapSM2U1->GetXaxis()->SetTitle("MEU");
04220   hSigMapSM2U1->GetXaxis()->CenterTitle();
04221 
04222   TH1F* hSigMapSM2U2=new TH1F("hSigMapSM2U2","hSigMapSM2U2",3001,-1,3000);
04223   hSigMapSM2U2->SetFillColor(0);
04224   hSigMapSM2U2->SetTitle("MEU in SigMap Units");
04225   hSigMapSM2U2->GetXaxis()->SetTitle("MEU");
04226   hSigMapSM2U2->GetXaxis()->CenterTitle();
04227 
04228   TH1F* hSigMapSM2V1=new TH1F("hSigMapSM2V1","hSigMapSM2V1",3001,-1,3000);
04229   hSigMapSM2V1->SetFillColor(0);
04230   hSigMapSM2V1->SetTitle("MEU in SigMap Units");
04231   hSigMapSM2V1->GetXaxis()->SetTitle("MEU");
04232   hSigMapSM2V1->GetXaxis()->CenterTitle();
04233 
04234   TH1F* hSigMapSM2V2=new TH1F("hSigMapSM2V2","hSigMapSM2V2",3001,-1,3000);
04235   hSigMapSM2V2->SetFillColor(0);
04236   hSigMapSM2V2->SetTitle("MEU in SigMap Units");
04237   hSigMapSM2V2->GetXaxis()->SetTitle("MEU");
04238   hSigMapSM2V2->GetXaxis()->CenterTitle();
04239 
04240   //separate SMs
04241   TH1F* hSigMapSM1=new TH1F("hSigMapSM1","hSigMapSM1",3001,-1,3000);
04242   hSigMapSM1->SetFillColor(0);
04243   hSigMapSM1->SetTitle("MEU in SigMap Units");
04244   hSigMapSM1->GetXaxis()->SetTitle("MEU");
04245   hSigMapSM1->GetXaxis()->CenterTitle();
04246 
04247   TH1F* hSigMapSM2=new TH1F("hSigMapSM2","hSigMapSM2",3001,-1,3000);
04248   hSigMapSM2->SetFillColor(0);
04249   hSigMapSM2->SetTitle("MEU in SigMap Units");
04250   hSigMapSM2->GetXaxis()->SetTitle("MEU");
04251   hSigMapSM2->GetXaxis()->CenterTitle();
04252 
04253   //forward and backward
04254   TH1F* hSigMapForw=new TH1F("hSigMapForw","hSigMapForw",3001,-1,3000);
04255   hSigMapForw->SetFillColor(0);
04256   hSigMapForw->SetTitle("MEU in SigMap Units (Forward Going)");
04257   hSigMapForw->GetXaxis()->SetTitle("MEU");
04258   hSigMapForw->GetXaxis()->CenterTitle();
04259 
04260   TH1F* hSigMapBack=new TH1F("hSigMapBack","hSigMapBack",3001,-1,3000);
04261   hSigMapBack->SetFillColor(0);
04262   hSigMapBack->SetTitle("MEU in SigMap Units (Backward Going)");
04263   hSigMapBack->GetXaxis()->SetTitle("MEU");
04264   hSigMapBack->GetXaxis()->CenterTitle();
04265 
04266   //BFIELD forward and backward
04267   TH1F* hSigMapBForw=new TH1F("hSigMapBForw","hSigMapBForw",
04268                               3001,-1,3000);
04269   hSigMapBForw->SetFillColor(0);
04270   hSigMapBForw->SetTitle("MEU in SigMap Units (Forward Going)");
04271   hSigMapBForw->GetXaxis()->SetTitle("MEU");
04272   hSigMapBForw->GetXaxis()->CenterTitle();
04273 
04274   TH1F* hSigMapBBack=new TH1F("hSigMapBBack","hSigMapBBack",
04275                               3001,-1,3000);
04276   hSigMapBBack->SetFillColor(0);
04277   hSigMapBBack->SetTitle("MEU in SigMap Units (Backward Going)");
04278   hSigMapBBack->GetXaxis()->SetTitle("MEU");
04279   hSigMapBBack->GetXaxis()->CenterTitle();
04280 
04281   TH1F* hSigMapAll=new TH1F("hSigMapAll","hSigMapAll",20000,-1,20000);
04282   hSigMapAll->SetFillColor(0);
04283   hSigMapAll->SetTitle("MEU in SigMap Units");
04284   hSigMapAll->GetXaxis()->SetTitle("MEU");
04285   hSigMapAll->GetXaxis()->CenterTitle();
04286   hSigMapAll->SetBit(TH1::kCanRebin);
04287 
04288   TH1F* hAvNumDigits=new TH1F("hAvNumDigits","hAvNumDigits",
04289                               300,-1,30);
04290   hAvNumDigits->SetFillColor(0);
04291   hAvNumDigits->SetTitle("Av. Num. Digits");
04292   hAvNumDigits->GetXaxis()->SetTitle("Av. Num. Digits");
04293   hAvNumDigits->GetXaxis()->CenterTitle();
04294 
04295 
04296 
04297   TH1F* hAvNumDigitsAll=new TH1F("hAvNumDigitsAll","hAvNumDigitsAll",
04298                                  3000,-1,300);
04299   hAvNumDigitsAll->SetFillColor(0);
04300   hAvNumDigitsAll->SetTitle("Av. Num. Digits");
04301   hAvNumDigitsAll->GetXaxis()->SetTitle("Av. Num. Digits");
04302   hAvNumDigitsAll->GetXaxis()->CenterTitle();
04303   
04304   TH1F* hAvNumStrips=new TH1F("hAvNumStrips","hAvNumStrips",
04305                               300,-1,30);
04306   hAvNumStrips->SetFillColor(0);
04307   hAvNumStrips->SetTitle("Av. Num. Strips");
04308   hAvNumStrips->GetXaxis()->SetTitle("Av. Num. Strips");
04309   hAvNumStrips->GetXaxis()->CenterTitle();
04310 
04311   TH1F* hAvNumStripsAll=new TH1F("hAvNumStripsAll","hAvNumStripsAll",
04312                                  3000,-1,300);
04313   hAvNumStripsAll->SetFillColor(0);
04314   hAvNumStripsAll->SetTitle("Av. Num. Strips");
04315   hAvNumStripsAll->GetXaxis()->SetTitle("Av. Num. Strips");
04316   hAvNumStripsAll->GetXaxis()->CenterTitle();
04317   
04318   TH1F* hAdc=new TH1F("hAdc","hAdc",3001,-1,3000);
04319   hAdc->SetFillColor(0);
04320   hAdc->SetTitle("MEU in ADCs");
04321   hAdc->GetXaxis()->SetTitle("ADC");
04322   hAdc->GetXaxis()->CenterTitle();
04323 
04324   TH1F* hPe=new TH1F("hPe","hPe",500,-1,50);
04325   hPe->SetFillColor(0);
04326   hPe->SetTitle("MEU in PEs");
04327   hPe->GetXaxis()->SetTitle("PE");
04328   hPe->GetXaxis()->CenterTitle();
04329 
04330   TH1F* hPeRaw=new TH1F("hPeRaw","hPeRaw",500,-1,50);
04331   hPeRaw->SetFillColor(0);
04332   hPeRaw->SetTitle("MEU in Raw PEs (not path corr.)");
04333   hPeRaw->GetXaxis()->SetTitle("PE");
04334   hPeRaw->GetXaxis()->CenterTitle();
04335 
04336   TH1F* hSigLin=new TH1F("hSigLin","hSigLin",3001,-1,3000);
04337   hSigLin->SetFillColor(0);
04338   hSigLin->SetTitle("MEU in SigLins");
04339   hSigLin->GetXaxis()->SetTitle("SigLin");
04340   hSigLin->GetXaxis()->CenterTitle();
04341 
04342   TH1F* hSigCor=new TH1F("hSigCor","hSigCor",3001,-1,3000);
04343   hSigCor->SetFillColor(0);
04344   hSigCor->SetTitle("MEU in SigCors");
04345   hSigCor->GetXaxis()->SetTitle("SigCor");
04346   hSigCor->GetXaxis()->CenterTitle();
04347 
04348   //these are not in the ntuple but calculated if recalibration is done
04349   //the Win postfix means it is calculated in this class
04350   TH1F* hSigDrf=new TH1F("hSigDrf","hSigDrf",3001,-1,3000);
04351   hSigDrf->SetFillColor(0);
04352   hSigDrf->SetTitle("MEU in SigDrfs");
04353   hSigDrf->GetXaxis()->SetTitle("SigDrf");
04354   hSigDrf->GetXaxis()->CenterTitle();
04355 
04356   TH1F* hSigLinOnly=new TH1F("hSigLinOnly","hSigLinOnly",3001,-1,3000);
04357   hSigLinOnly->SetFillColor(0);
04358   hSigLinOnly->SetTitle("MEU in SigLin (no drift)");
04359   hSigLinOnly->GetXaxis()->SetTitle("SigLinOnly");
04360   hSigLinOnly->GetXaxis()->CenterTitle();
04361 
04362   TH1F* hSigDrfWin=new TH1F("hSigDrfWin","hSigDrfWin",3001,-1,3000);
04363   hSigDrfWin->SetFillColor(0);
04364   hSigDrfWin->SetTitle("MEU in SigDrfs");
04365   hSigDrfWin->GetXaxis()->SetTitle("SigDrf");
04366   hSigDrfWin->GetXaxis()->CenterTitle();
04367 
04368   TH1F* hSigLinOnlyWin=new TH1F("hSigLinOnlyWin","hSigLinOnlyWin",
04369                                 3001,-1,3000);
04370   hSigLinOnlyWin->SetFillColor(0);
04371   hSigLinOnlyWin->SetTitle("MEU in SigLin (no drift)");
04372   hSigLinOnlyWin->GetXaxis()->SetTitle("SigLinOnly");
04373   hSigLinOnlyWin->GetXaxis()->CenterTitle();
04374 
04375 
04376 
04377   TH1F* hMatTrav=new TH1F("hMatTrav","hMatTrav",1000,0,10);
04378   hMatTrav->SetFillColor(0);
04379   hMatTrav->SetTitle("Distance Travelled by Muon");
04380   hMatTrav->GetXaxis()->SetTitle("Distance (m)");
04381   hMatTrav->GetXaxis()->CenterTitle();
04382   //hMatTrav->SetBit(TH1::kCanRebin);
04383   
04384   TH1F* hHighEn=new TH1F("hHighEn","hHighEn",10000,0,500);
04385   hHighEn->SetFillColor(0);
04386   hHighEn->SetTitle("Highest Muon Energy in Scintillator");
04387   hHighEn->GetXaxis()->SetTitle("Muon Energy (GeV)");
04388   hHighEn->GetXaxis()->CenterTitle();
04389   hHighEn->SetBit(TH1::kCanRebin);
04390 
04391   TH1F* hLowEn=new TH1F("hLowEn","hLowEn",50000,0,500);
04392   hLowEn->SetFillColor(0);
04393   hLowEn->SetTitle("Lowest Muon Energy in Scintillator");
04394   hLowEn->GetXaxis()->SetTitle("Muon Energy (GeV)");
04395   hLowEn->GetXaxis()->CenterTitle();
04396   hLowEn->SetBit(TH1::kCanRebin);
04397 
04398   TProfile* pLowEnVsCosThZ=new TProfile("pLowEnVsCosThZ",
04399                                         "pLowEnVsCosThZ",40,-1,1);
04400   TProfile* pLowEnVsX=new TProfile("pLowEnVsX","pLowEnVsX",40,-4,4);
04401   TProfile* pLowEnVsY=new TProfile("pLowEnVsY","pLowEnVsY",40,-4,4);
04402 
04403   TH2F* hLowEnVsX=new TH2F("hLowEnVsX","hLowEnVsX",40,-4,4,120,0.1,1);
04404   TH2F* hLowEnVsY=new TH2F("hLowEnVsY","hLowEnVsY",40,-4,4,120,0.1,1);
04405 
04406   map<Int_t,TH1F*> meuCosTh;
04407   for (Int_t i=0;i<20;i++){
04408     string sName="hMeuCosTh";
04409     string sNum=Form("%d",i);
04410     sName+=sNum;
04411     meuCosTh[i]=new TH1F(sName.c_str(),sName.c_str(),5000,0,5000);
04412   }
04413 
04414   TH1F* hCosThZ=new TH1F("hCosThZ","hCosThZ",20,-1,1);
04415   hCosThZ->SetFillColor(0);
04416   hCosThZ->SetTitle("Distribution of Cos(#theta_{z})");
04417   hCosThZ->GetXaxis()->SetTitle("Cos(#theta_{z})");
04418   hCosThZ->GetXaxis()->CenterTitle();
04419   //hCosThZ->SetBit(TH1::kCanRebin);
04420 
04421   TH1F* hCosThZBForw=new TH1F("hCosThZBForw","hCosThZBForw",20,-1,1);
04422   hCosThZBForw->SetFillColor(0);
04423   hCosThZBForw->SetTitle("Distribution of Cos(#theta_{z})");
04424   hCosThZBForw->GetXaxis()->SetTitle("Cos(#theta_{z})");
04425   hCosThZBForw->GetXaxis()->CenterTitle();
04426   //hCosThZBForw->SetBit(TH1::kCanRebin);
04427 
04428   TH1F* hCosThZBBack=new TH1F("hCosThZBBack","hCosThZBBack",20,-1,1);
04429   hCosThZBBack->SetFillColor(0);
04430   hCosThZBBack->SetTitle("Distribution of Cos(#theta_{z})");
04431   hCosThZBBack->GetXaxis()->SetTitle("Cos(#theta_{z})");
04432   hCosThZBBack->GetXaxis()->CenterTitle();
04433   //hCosThZBBack->SetBit(TH1::kCanRebin);
04434 
04435   //efficiency plots
04436   TProfile* pEffVsPl=new TProfile
04437     ("pEffVsPl","pEffVsPl",486,0,486);
04438   TProfile* pEffTrkVsPl=new TProfile
04439     ("pEffTrkVsPl","pEffTrkVsPl",486,0,486);
04440 
04441   //distributions with plane
04442   TProfile* pMeuVsPl=new TProfile
04443     ("pMeuVsPl","pMeuVsPl",486,0,486);
04444   TProfile* pPeVsPl=new TProfile
04445     ("pPeVsPl","pPeVsPl",486,0,486);
04446   TProfile* pStsVsPl=new TProfile
04447     ("pStsVsPl","pStsVsPl",486,0,486);
04448   TProfile* pSLVsPl=new TProfile
04449     ("pSLVsPl","pSLVsPl",486,0,486);
04450   TProfile* pAdcVsPl=new TProfile
04451     ("pAdcVsPl","pAdcVsPl",486,0,486);
04452 
04453   //U planes
04454   TProfile* pMeuVsPlU=new TProfile
04455     ("pMeuVsPlU","pMeuVsPlU",486,0,486);
04456   pMeuVsPlU->SetLineColor(2);
04457   TProfile* pPeVsPlU=new TProfile
04458     ("pPeVsPlU","pPeVsPlU",486,0,486);
04459   pPeVsPlU->SetLineColor(2);
04460   TProfile* pStsVsPlU=new TProfile
04461     ("pStsVsPlU","pStsVsPlU",486,0,486);
04462   pStsVsPlU->SetLineColor(2);
04463   TProfile* pSLVsPlU=new TProfile
04464     ("pSLVsPlU","pSLVsPlU",486,0,486);
04465   pSLVsPlU->SetLineColor(2);
04466   TProfile* pAdcVsPlU=new TProfile
04467     ("pAdcVsPlU","pAdcVsPlU",486,0,486);
04468   pAdcVsPlU->SetLineColor(2);
04469 
04470   //V planes
04471   TProfile* pMeuVsPlV=new TProfile
04472     ("pMeuVsPlV","pMeuVsPlV",486,0,486);
04473   pMeuVsPlV->SetLineColor(4);
04474   TProfile* pPeVsPlV=new TProfile
04475     ("pPeVsPlV","pPeVsPlV",486,0,486);
04476   pPeVsPlV->SetLineColor(4);
04477   TProfile* pStsVsPlV=new TProfile
04478     ("pStsVsPlV","pStsVsPlV",486,0,486);
04479   pStsVsPlV->SetLineColor(4);
04480   TProfile* pSLVsPlV=new TProfile
04481     ("pSLVsPlV","pSLVsPlV",486,0,486);
04482   pSLVsPlV->SetLineColor(4);
04483   TProfile* pAdcVsPlV=new TProfile
04484     ("pAdcVsPlV","pAdcVsPlV",486,0,486);
04485   pAdcVsPlV->SetLineColor(4);
04486 
04487   TProfile* pMeuVsPl1=new TProfile
04488     ("pMeuVsPl1","pMeuVsPl1",486,0,486);
04489   TProfile* pPeVsPl1=new TProfile
04490     ("pPeVsPl1","pPeVsPl1",486,0,486);
04491   TProfile* pStsVsPl1=new TProfile
04492     ("pStsVsPl1","pStsVsPl1",486,0,486);
04493   TProfile* pSLVsPl1=new TProfile
04494     ("pSLVsPl1","pSLVsPl1",486,0,486);
04495   TProfile* pAdcVsPl1=new TProfile
04496     ("pAdcVsPl1","pAdcVsPl1",486,0,486);
04497 
04498   TProfile* pMeuVsPl2=new TProfile
04499     ("pMeuVsPl2","pMeuVsPl2",486,0,486);
04500   TProfile* pPeVsPl2=new TProfile
04501     ("pPeVsPl2","pPeVsPl2",486,0,486);
04502   TProfile* pStsVsPl2=new TProfile
04503     ("pStsVsPl2","pStsVsPl2",486,0,486);
04504   TProfile* pSLVsPl2=new TProfile
04505     ("pSLVsPl2","pSLVsPl2",486,0,486);
04506   TProfile* pAdcVsPl2=new TProfile
04507     ("pAdcVsPl2","pAdcVsPl2",486,0,486);
04508 
04509   TProfile* pMeuVsPl4=new TProfile
04510     ("pMeuVsPl4","pMeuVsPl4",486/4,0,486);
04511   TProfile* pPeVsPl4=new TProfile
04512     ("pPeVsPl4","pPeVsPl4",486/4,0,486);
04513   TProfile* pStsVsPl4=new TProfile
04514     ("pStsVsPl4","pStsVsPl4",486/4,0,486);
04515   TProfile* pSLVsPl4=new TProfile
04516     ("pSLVsPl4","pSLVsPl4",486/4,0,486);
04517   TProfile* pAdcVsPl4=new TProfile
04518     ("pAdcVsPl4","pAdcVsPl4",486/4,0,486);
04519   
04520   TProfile* pMeuVsPl8=new TProfile
04521     ("pMeuVsPl8","pMeuVsPl8",486/8,0,486);
04522   TProfile* pPeVsPl8=new TProfile
04523     ("pPeVsPl8","pPeVsPl8",486/8,0,486);
04524   TProfile* pStsVsPl8=new TProfile
04525     ("pStsVsPl8","pStsVsPl8",486/8,0,486);
04526   TProfile* pSLVsPl8=new TProfile
04527     ("pSLVsPl8","pSLVsPl8",486/8,0,486);
04528   TProfile* pAdcVsPl8=new TProfile
04529     ("pAdcVsPl8","pAdcVsPl8",486/8,0,486);
04530 
04531   TProfile* pMeuVsPl16=new TProfile
04532     ("pMeuVsPl16","pMeuVsPl16",486/16,0,486);
04533   TProfile* pPeVsPl16=new TProfile
04534     ("pPeVsPl16","pPeVsPl16",486/16,0,486);
04535   TProfile* pStsVsPl16=new TProfile
04536     ("pStsVsPl16","pStsVsPl16",486/16,0,486);
04537   TProfile* pSLVsPl16=new TProfile
04538     ("pSLVsPl16","pSLVsPl16",486/16,0,486);
04539   TProfile* pAdcVsPl16=new TProfile
04540     ("pAdcVsPl16","pAdcVsPl16",486/16,0,486);
04541   
04542   //ones at a special time
04543   TProfile* pMeuVsPlT16=new TProfile
04544     ("pMeuVsPlT16","pMeuVsPlT16",486/16,0,486);
04545   TProfile* pStsVsPlT16=new TProfile
04546     ("pStsVsPlT16","pStsVsPlT16",486/16,0,486);
04547   TProfile* pSLVsPlT16=new TProfile
04548     ("pSLVsPlT16","pSLVsPlT16",486/16,0,486);
04549   TProfile* pAdcVsPlT16=new TProfile
04550     ("pAdcVsPlT16","pAdcVsPlT16",486/16,0,486);
04551 
04552   //distributions with strip
04553   TProfile* pMeuVsStripU=new TProfile("pMeuVsStripU","pMeuVsStripU",
04554                                       194,-1,193);
04555   TProfile* pMeuVsStripUF=new TProfile("pMeuVsStripUF","pMeuVsStripUF",
04556                                        194,-1,193);
04557   TProfile* pMeuVsStripUP=new TProfile("pMeuVsStripUP","pMeuVsStripUP",
04558                                        194,-1,193);
04559   TProfile* pStsVsStripU=new TProfile("pStsVsStripU","pStsVsStripU",
04560                                        194,-1,193);
04561   TProfile* pStsVsStripUF=new TProfile("pStsVsStripUF","pStsVsStripUF",
04562                                        194,-1,193);
04563   TProfile* pStsVsStripUP=new TProfile("pStsVsStripUP","pStsVsStripUP",
04564                                        194,-1,193);
04565   TProfile* pAdcVsStripU=new TProfile("pAdcVsStripU","pAdcVsStripU",
04566                                        194,-1,193);
04567   TProfile* pAdcVsStripUF=new TProfile("pAdcVsStripUF","pAdcVsStripUF",
04568                                        194,-1,193);
04569   TProfile* pAdcVsStripUP=new TProfile("pAdcVsStripUP","pAdcVsStripUP",
04570                                        194,-1,193);
04571   TProfile* pPeVsStripU=new TProfile("pPeVsStripU","pPeVsStripU",
04572                                        194,-1,193);
04573   TProfile* pPeVsStripUF=new TProfile("pPeVsStripUF","pPeVsStripUF",
04574                                        194,-1,193);
04575   TProfile* pPeVsStripUP=new TProfile("pPeVsStripUP","pPeVsStripUP",
04576                                        194,-1,193);
04577 
04578   TProfile* pMeuVsStripV=new TProfile("pMeuVsStripV","pMeuVsStripV",
04579                                       194,-1,193);
04580   TProfile* pMeuVsStripVF=new TProfile("pMeuVsStripVF","pMeuVsStripVF",
04581                                        194,-1,193);
04582   TProfile* pMeuVsStripVP=new TProfile("pMeuVsStripVP","pMeuVsStripVP",
04583                                        194,-1,193);
04584   TProfile* pStsVsStripV=new TProfile("pStsVsStripV","pStsVsStripV",
04585                                        194,-1,193);
04586   TProfile* pStsVsStripVF=new TProfile("pStsVsStripVF","pStsVsStripVF",
04587                                        194,-1,193);
04588   TProfile* pStsVsStripVP=new TProfile("pStsVsStripVP","pStsVsStripVP",
04589                                        194,-1,193);
04590   TProfile* pAdcVsStripV=new TProfile("pAdcVsStripV","pAdcVsStripV",
04591                                        194,-1,193);
04592   TProfile* pAdcVsStripVF=new TProfile("pAdcVsStripVF","pAdcVsStripVF",
04593                                        194,-1,193);
04594   TProfile* pAdcVsStripVP=new TProfile("pAdcVsStripVP","pAdcVsStripVP",
04595                                        194,-1,193);
04596   TProfile* pPeVsStripV=new TProfile("pPeVsStripV","pPeVsStripV",
04597                                        194,-1,193);
04598   TProfile* pPeVsStripVF=new TProfile("pPeVsStripVF","pPeVsStripVF",
04599                                        194,-1,193);
04600   TProfile* pPeVsStripVP=new TProfile("pPeVsStripVP","pPeVsStripVP",
04601                                        194,-1,193);
04602 
04603   //distributions with x and y
04604   TProfile* pMeuVsX=new TProfile("pMeuVsX","pMeuVsX",20,-5,5);
04605   TProfile* pMeuVsY=new TProfile("pMeuVsY","pMeuVsY",20,-5,5);
04606   TProfile* pMeuVsXU=new TProfile("pMeuVsXU","pMeuVsXU",20,-5,5);
04607   TProfile* pMeuVsYU=new TProfile("pMeuVsYU","pMeuVsYU",20,-5,5);
04608   TProfile* pMeuVsXV=new TProfile("pMeuVsXV","pMeuVsXV",20,-5,5);
04609   TProfile* pMeuVsYV=new TProfile("pMeuVsYV","pMeuVsYV",20,-5,5);
04610 
04611   //distributions with tpos, lpos and strip
04612   TProfile* pMeuVsStripU20=new TProfile
04613     ("pMeuVsStripU20","pMeuVsStripU20",20,0,192);
04614   TProfile* pMeuVsStripV20=new TProfile
04615     ("pMeuVsStripV20","pMeuVsStripV20",20,0,192);  
04616   TProfile* pMeuVsTU=new TProfile("pMeuVsTU","pMeuVsTU",20,-5,5);
04617   TProfile* pMeuVsTV=new TProfile("pMeuVsTV","pMeuVsTV",20,-5,5);
04618   TProfile* pMeuVsLU=new TProfile("pMeuVsLU","pMeuVsLU",20,-5,5);  
04619   TProfile* pMeuVsLV=new TProfile("pMeuVsLV","pMeuVsLV",20,-5,5);
04620   TProfile* pMeuVsTU8=new TProfile("pMeuVsTU8","pMeuVsTU8",20,-5,5);
04621   TProfile* pMeuVsLU8=new TProfile("pMeuVsLU8","pMeuVsLU8",20,-5,5);
04622   TProfile* pMeuVsLU18=new TProfile("pMeuVsLU18","pMeuVsLU18",20,-5,5);
04623   TProfile* pMeuVsLU28=new TProfile("pMeuVsLU28","pMeuVsLU28",20,-5,5);
04624   TProfile* pMeuVsTV8=new TProfile("pMeuVsTV8","pMeuVsTV8",20,-5,5);
04625   TProfile* pMeuVsLV8=new TProfile("pMeuVsLV8","pMeuVsLV8",20,-5,5);
04626   TProfile* pMeuVsLV18=new TProfile("pMeuVsLV18","pMeuVsLV18",20,-5,5);
04627   TProfile* pMeuVsLV28=new TProfile("pMeuVsLV28","pMeuVsLV28",20,-5,5);
04628 
04629   //the first 1/2 is stripend, the second refers to +/- 1m in lpos
04630   TProfile* pMeuVsTU11=new TProfile("pMeuVsTU11","pMeuVsTU11",20,-5,5);
04631   TProfile* pMeuVsTU21=new TProfile("pMeuVsTU21","pMeuVsTU21",20,-5,5);
04632   TProfile* pMeuVsTV11=new TProfile("pMeuVsTV11","pMeuVsTV11",20,-5,5);
04633   TProfile* pMeuVsTV21=new TProfile("pMeuVsTV21","pMeuVsTV21",20,-5,5);
04634 
04635   //the first 1/2 is stripend, the 5 refers to +/- 0.5m in lpos
04636   TProfile* pMeuVsTU15=new TProfile("pMeuVsTU15","pMeuVsTU15",20,-5,5);
04637   TProfile* pMeuVsTU25=new TProfile("pMeuVsTU25","pMeuVsTU25",20,-5,5);
04638   TProfile* pMeuVsTV15=new TProfile("pMeuVsTV15","pMeuVsTV15",20,-5,5);
04639   TProfile* pMeuVsTV25=new TProfile("pMeuVsTV25","pMeuVsTV25",20,-5,5);
04640 
04641   TProfile* pCorVsTU=new TProfile("pCorVsTU","pCorVsTU",20,-5,5);
04642   TProfile* pCorVsLU=new TProfile("pCorVsLU","pCorVsLU",20,-5,5);
04643   TProfile* pCorVsTV=new TProfile("pCorVsTV","pCorVsTV",20,-5,5);
04644   TProfile* pCorVsLV=new TProfile("pCorVsLV","pCorVsLV",20,-5,5);
04645   
04646   TProfile* pCorVsTU8=new TProfile("pCorVsTU8","pCorVsTU8",20,-5,5);
04647   TProfile* pCorVsLU8=new TProfile("pCorVsLU8","pCorVsLU8",20,-5,5);
04648   TProfile* pCorVsLU18=new TProfile("pCorVsLU18","pCorVsLU18",20,-5,5);
04649   TProfile* pCorVsLU28=new TProfile("pCorVsLU28","pCorVsLU28",20,-5,5);
04650   TProfile* pCorVsTV8=new TProfile("pCorVsTV8","pCorVsTV8",20,-5,5);
04651   TProfile* pCorVsLV8=new TProfile("pCorVsLV8","pCorVsLV8",20,-5,5);
04652   TProfile* pCorVsLV18=new TProfile("pCorVsLV18","pCorVsLV18",20,-5,5);
04653   TProfile* pCorVsLV28=new TProfile("pCorVsLV28","pCorVsLV28",20,-5,5);
04654 
04655   TProfile* pAdcVsLU8=new TProfile("pAdcVsLU8","pAdcVsLU8",20,-5,5);
04656   TProfile* pAdcVsLV8=new TProfile("pAdcVsLV8","pAdcVsLV8",20,-5,5);
04657   TProfile* pAdcVsLU18=new TProfile("pAdcVsLU18","pAdcVsLU18",20,-5,5);
04658   TProfile* pAdcVsLU28=new TProfile("pAdcVsLU28","pAdcVsLU28",20,-5,5);
04659   TProfile* pAdcVsLV18=new TProfile("pAdcVsLV18","pAdcVsLV18",20,-5,5);
04660   TProfile* pAdcVsLV28=new TProfile("pAdcVsLV28","pAdcVsLV28",20,-5,5);
04661 
04662   TProfile* pAdcVsTU1=new TProfile("pAdcVsTU1","pAdcVsTU1",20,-5,5);
04663   TProfile* pAdcVsTU2=new TProfile("pAdcVsTU2","pAdcVsTU2",20,-5,5);
04664   TProfile* pAdcVsTV1=new TProfile("pAdcVsTV1","pAdcVsTV1",20,-5,5);
04665   TProfile* pAdcVsTV2=new TProfile("pAdcVsTV2","pAdcVsTV2",20,-5,5);
04666   
04667   TProfile* pPeVsLU8=new TProfile("pPeVsLU8","pPeVsLU8",20,-5,5);
04668   TProfile* pPeVsLV8=new TProfile("pPeVsLV8","pPeVsLV8",20,-5,5);
04669   TProfile* pPeVsLU18=new TProfile("pPeVsLU18","pPeVsLU18",20,-5,5);
04670   TProfile* pPeVsLU28=new TProfile("pPeVsLU28","pPeVsLU28",20,-5,5);
04671   TProfile* pPeVsLV18=new TProfile("pPeVsLV18","pPeVsLV18",20,-5,5);
04672   TProfile* pPeVsLV28=new TProfile("pPeVsLV28","pPeVsLV28",20,-5,5);
04673 
04674   
04675 
04677   //high bin (resolution) profiles - 40
04678   //distributions with x and y
04679   TProfile* pMeuVs40X=new TProfile("pMeuVs40X","pMeuVs40X",40,-5,5);
04680   TProfile* pMeuVs40Y=new TProfile("pMeuVs40Y","pMeuVs40Y",40,-5,5);
04681   TProfile* pMeuVs40XU=new TProfile("pMeuVs40XU","pMeuVs40XU",40,-5,5);
04682   TProfile* pMeuVs40YU=new TProfile("pMeuVs40YU","pMeuVs40YU",40,-5,5);
04683   TProfile* pMeuVs40XV=new TProfile("pMeuVs40XV","pMeuVs40XV",40,-5,5);
04684   TProfile* pMeuVs40YV=new TProfile("pMeuVs40YV","pMeuVs40YV",40,-5,5);
04685 
04686   //distributions with tpos and lpos (or strip)
04687   TProfile* pMeuVs40TU=new TProfile
04688     ("pMeuVs40TU","pMeuVs40TU",40,-5,5);
04689   TProfile* pMeuVs40StripU=new TProfile
04690     ("pMeuVs40StripU","pMeuVs40StripU",40,0,192);
04691   TProfile* pMeuVs40LU=new TProfile
04692     ("pMeuVs40LU","pMeuVs40LU",40,-5,5);
04693   TProfile* pMeuVs40TV=new TProfile
04694     ("pMeuVs40TV","pMeuVs40TV",40,-5,5);
04695   TProfile* pMeuVs40StripV=new TProfile
04696     ("pMeuVs40StripV","pMeuVs40StripV",40,0,192);
04697   TProfile* pMeuVs40LV=new TProfile
04698     ("pMeuVs40LV","pMeuVs40LV",40,-5,5);
04699   TProfile* pMeuVs40TU8=new TProfile
04700     ("pMeuVs40TU8","pMeuVs40TU8",40,-5,5);
04701   TProfile* pMeuVs40LU8=new TProfile
04702     ("pMeuVs40LU8","pMeuVs40LU8",40,-5,5);
04703   TProfile* pMeuVs40LU18=new TProfile
04704     ("pMeuVs40LU18","pMeuVs40LU18",40,-5,5);
04705   TProfile* pMeuVs40LU28=new TProfile
04706     ("pMeuVs40LU28","pMeuVs40LU28",40,-5,5);
04707   TProfile* pMeuVs40TV8=new TProfile
04708     ("pMeuVs40TV8","pMeuVs40TV8",40,-5,5);
04709   TProfile* pMeuVs40LV8=new TProfile
04710     ("pMeuVs40LV8","pMeuVs40LV8",40,-5,5);
04711   TProfile* pMeuVs40LV18=new TProfile
04712     ("pMeuVs40LV18","pMeuVs40LV18",40,-5,5);
04713   TProfile* pMeuVs40LV28=new TProfile
04714     ("pMeuVs40LV28","pMeuVs40LV28",40,-5,5);
04715 
04716   //the first 1/2 is stripend, the second refers to +/- 1m in lpos
04717   TProfile* pMeuVs40TU11=new TProfile
04718     ("pMeuVs40TU11","pMeuVs40TU11",40,-5,5);
04719   TProfile* pMeuVs40TU21=new TProfile
04720     ("pMeuVs40TU21","pMeuVs40TU21",40,-5,5);
04721   TProfile* pMeuVs40TV11=new TProfile
04722     ("pMeuVs40TV11","pMeuVs40TV11",40,-5,5);
04723   TProfile* pMeuVs40TV21=new TProfile
04724     ("pMeuVs40TV21","pMeuVs40TV21",40,-5,5);
04725 
04726   //the first 1/2 is stripend, the 5 refers to +/- 0.5m in lpos
04727   TProfile* pMeuVs40TU15=new TProfile
04728     ("pMeuVs40TU15","pMeuVs40TU15",40,-5,5);
04729   TProfile* pMeuVs40TU25=new TProfile
04730     ("pMeuVs40TU25","pMeuVs40TU25",40,-5,5);
04731   TProfile* pMeuVs40TV15=new TProfile
04732     ("pMeuVs40TV15","pMeuVs40TV15",40,-5,5);
04733   TProfile* pMeuVs40TV25=new TProfile
04734     ("pMeuVs40TV25","pMeuVs40TV25",40,-5,5);
04735 
04736   TProfile* pCorVs40TU=new TProfile
04737     ("pCorVs40TU","pCorVs40TU",40,-5,5);
04738   TProfile* pCorVs40LU=new TProfile
04739     ("pCorVs40LU","pCorVs40LU",40,-5,5);
04740   TProfile* pCorVs40TV=new TProfile
04741     ("pCorVs40TV","pCorVs40TV",40,-5,5);
04742   TProfile* pCorVs40LV=new TProfile
04743     ("pCorVs40LV","pCorVs40LV",40,-5,5);
04744   
04745   TProfile* pCorVs40TU8=new TProfile
04746     ("pCorVs40TU8","pCorVs40TU8",40,-5,5);
04747   TProfile* pCorVs40LU8=new TProfile
04748     ("pCorVs40LU8","pCorVs40LU8",40,-5,5);
04749   TProfile* pCorVs40LU18=new TProfile
04750     ("pCorVs40LU18","pCorVs40LU18",40,-5,5);
04751   TProfile* pCorVs40LU28=new TProfile
04752     ("pCorVs40LU28","pCorVs40LU28",40,-5,5);
04753   TProfile* pCorVs40TV8=new TProfile
04754     ("pCorVs40TV8","pCorVs40TV8",40,-5,5);
04755   TProfile* pCorVs40LV8=new TProfile
04756     ("pCorVs40LV8","pCorVs40LV8",40,-5,5);
04757   TProfile* pCorVs40LV18=new TProfile
04758     ("pCorVs40LV18","pCorVs40LV18",40,-5,5);
04759   TProfile* pCorVs40LV28=new TProfile
04760     ("pCorVs40LV28","pCorVs40LV28",40,-5,5);
04761   
04762   TProfile* pAdcVs40LU8=new TProfile
04763     ("pAdcVs40LU8","pAdcVs40LU8",40,-5,5);
04764   TProfile* pAdcVs40LV8=new TProfile
04765     ("pAdcVs40LV8","pAdcVs40LV8",40,-5,5);
04766   TProfile* pAdcVs40LU18=new TProfile
04767     ("pAdcVs40LU18","pAdcVs40LU18",40,-5,5);
04768   TProfile* pAdcVs40LU28=new TProfile
04769     ("pAdcVs40LU28","pAdcVs40LU28",40,-5,5);
04770   TProfile* pAdcVs40LV18=new TProfile
04771     ("pAdcV1s40LV18","pAdcVs40LV18",40,-5,5);
04772   TProfile* pAdcVs40LV28=new TProfile
04773     ("pAdcVs40LV28","pAdcVs40LV28",40,-5,5);
04774 
04775   TProfile* pAdcVs40TU1=new TProfile
04776     ("pAdcVs40TU1","pAdcVs40TU1",40,-5,5);
04777   TProfile* pAdcVs40TU2=new TProfile
04778     ("pAdcVs40TU2","pAdcVs40TU2",40,-5,5);
04779   TProfile* pAdcVs40TV1=new TProfile
04780     ("pAdcVs40TV1","pAdcVs40TV1",40,-5,5);
04781   TProfile* pAdcVs40TV2=new TProfile
04782     ("pAdcVs40TV2","pAdcVs40TV2",40,-5,5);
04783   
04784   TProfile* pPeVs40LU8=new TProfile
04785     ("pPeVs40LU8","pPeVs40LU8",40,-5,5);
04786   TProfile* pPeVs40LV8=new TProfile
04787     ("pPeVs40LV8","pPeVs40LV8",40,-5,5);
04788   TProfile* pPeVs40LU18=new TProfile
04789     ("pPeVs40LU18","pPeVs40LU18",40,-5,5);
04790   TProfile* pPeVs40LU28=new TProfile
04791     ("pPeVs40LU28","pPeVs40LU28",40,-5,5);
04792   TProfile* pPeVs40LV18=new TProfile
04793     ("pPeVs40LV18","pPeVs40LV18",40,-5,5);
04794   TProfile* pPeVs40LV28=new TProfile
04795     ("pPeVs40LV28","pPeVs40LV28",40,-5,5);
04796   
04797 
04799   //just value of track window sum
04800   TProfile2D* pYvsXMeu=new TProfile2D("pYvsXMeu","pYvsXMeu",
04801                                       30,-4,4,30,-4,4);
04802   pYvsXMeu->SetTitle("MEU");
04803   pYvsXMeu->GetXaxis()->SetTitle("X (m)");
04804   pYvsXMeu->GetXaxis()->CenterTitle();
04805   pYvsXMeu->GetYaxis()->SetTitle("Y (m)");
04806   pYvsXMeu->GetYaxis()->CenterTitle();
04807  
04808   TH2F* hYvsX15=new TH2F("hYvsX15","hYvsX15",15,-4,4,15,-4,4);
04809   hYvsX15->SetTitle("MEU");
04810   hYvsX15->GetXaxis()->SetTitle("X (m)");
04811   hYvsX15->GetXaxis()->CenterTitle();
04812   hYvsX15->GetYaxis()->SetTitle("Y (m)");
04813   hYvsX15->GetYaxis()->CenterTitle();
04814 
04815   TProfile2D* pYvsX15=new TProfile2D
04816     ("pYvsX15","pYvsX15",15,-4,4,15,-4,4);
04817   pYvsX15->SetTitle("MEU");
04818   pYvsX15->GetXaxis()->SetTitle("X (m)");
04819   pYvsX15->GetXaxis()->CenterTitle();
04820   pYvsX15->GetYaxis()->SetTitle("Y (m)");
04821   pYvsX15->GetYaxis()->CenterTitle();
04822 
04823   TProfile2D* pYvsX20=new TProfile2D
04824     ("pYvsX20","pYvsX20",20,-4,4,20,-4,4);
04825   pYvsX20->SetTitle("MEU");
04826   pYvsX20->GetXaxis()->SetTitle("X (m)");
04827   pYvsX20->GetXaxis()->CenterTitle();
04828   pYvsX20->GetYaxis()->SetTitle("Y (m)");
04829   pYvsX20->GetYaxis()->CenterTitle();
04830 
04831   TProfile2D* pYvsX22=new TProfile2D
04832     ("pYvsX22","pYvsX22",22,-4,4,22,-4,4);
04833   pYvsX22->SetTitle("MEU");
04834   pYvsX22->GetXaxis()->SetTitle("X (m)");
04835   pYvsX22->GetXaxis()->CenterTitle();
04836   pYvsX22->GetYaxis()->SetTitle("Y (m)");
04837   pYvsX22->GetYaxis()->CenterTitle();
04838 
04839   TProfile2D* pYvsX25=new TProfile2D
04840     ("pYvsX25","pYvsX25",25,-4,4,25,-4,4);
04841   pYvsX25->SetTitle("MEU");
04842   pYvsX25->GetXaxis()->SetTitle("X (m)");
04843   pYvsX25->GetXaxis()->CenterTitle();
04844   pYvsX25->GetYaxis()->SetTitle("Y (m)");
04845   pYvsX25->GetYaxis()->CenterTitle();
04846 
04847 
04848 
04850   //16 bins (not 15 so you don't straddle the coil hole)
04851   TH2F* hYvsX16=new TH2F("hYvsX16","hYvsX16",16,-4,4,16,-4,4);
04852   hYvsX16->SetTitle("MEU");
04853   hYvsX16->GetXaxis()->SetTitle("X (m)");
04854   hYvsX16->GetXaxis()->CenterTitle();
04855   hYvsX16->GetYaxis()->SetTitle("Y (m)");
04856   hYvsX16->GetYaxis()->CenterTitle();
04857 
04858   TProfile2D* pYvsX16=new TProfile2D("pYvsX16","pYvsX16",
04859                                      16,-4,4,16,-4,4);
04860   pYvsX16->SetTitle("MEU");
04861   pYvsX16->GetXaxis()->SetTitle("X (m)");
04862   pYvsX16->GetXaxis()->CenterTitle();
04863   pYvsX16->GetYaxis()->SetTitle("Y (m)");
04864   pYvsX16->GetYaxis()->CenterTitle();
04865 
04866   TH2F* hYvsX16U=new TH2F("hYvsX16U","hYvsX16U",16,-4,4,16,-4,4);
04867   hYvsX16U->SetTitle("MEU");
04868   hYvsX16U->GetXaxis()->SetTitle("X (m)");
04869   hYvsX16U->GetXaxis()->CenterTitle();
04870   hYvsX16U->GetYaxis()->SetTitle("Y (m)");
04871   hYvsX16U->GetYaxis()->CenterTitle();
04872 
04873   TProfile2D* pYvsX16U=new TProfile2D("pYvsX16U","pYvsX16U",
04874                                       16,-4,4,16,-4,4);
04875   pYvsX16U->SetTitle("MEU");
04876   pYvsX16U->GetXaxis()->SetTitle("X (m)");
04877   pYvsX16U->GetXaxis()->CenterTitle();
04878   pYvsX16U->GetYaxis()->SetTitle("Y (m)");
04879   pYvsX16U->GetYaxis()->CenterTitle();
04880 
04881   TProfile2D* pYvsX16U1=new TProfile2D("pYvsX16U1","pYvsX16U1",
04882                                        16,-4,4,16,-4,4);
04883   pYvsX16U1->SetTitle("MEU1");
04884   pYvsX16U1->GetXaxis()->SetTitle("X (m)");
04885   pYvsX16U1->GetXaxis()->CenterTitle();
04886   pYvsX16U1->GetYaxis()->SetTitle("Y (m)");
04887   pYvsX16U1->GetYaxis()->CenterTitle();
04888 
04889   TProfile2D* pYvsX16U2=new TProfile2D("pYvsX16U2","pYvsX16U2",
04890                                        16,-4,4,16,-4,4);
04891   pYvsX16U2->SetTitle("MEU2");
04892   pYvsX16U2->GetXaxis()->SetTitle("X (m)");
04893   pYvsX16U2->GetXaxis()->CenterTitle();
04894   pYvsX16U2->GetYaxis()->SetTitle("Y (m)");
04895   pYvsX16U2->GetYaxis()->CenterTitle();
04896 
04897   TH2F* hYvsX16V=new TH2F("hYvsX16V","hYvsX16V",16,-4,4,16,-4,4);
04898   hYvsX16V->SetTitle("MEU");
04899   hYvsX16V->GetXaxis()->SetTitle("X (m)");
04900   hYvsX16V->GetXaxis()->CenterTitle();
04901   hYvsX16V->GetYaxis()->SetTitle("Y (m)");
04902   hYvsX16V->GetYaxis()->CenterTitle();
04903 
04904   TProfile2D* pYvsX16V=new TProfile2D("pYvsX16V","pYvsX16V",
04905                                       16,-4,4,16,-4,4);
04906   pYvsX16V->SetTitle("MEU");
04907   pYvsX16V->GetXaxis()->SetTitle("X (m)");
04908   pYvsX16V->GetXaxis()->CenterTitle();
04909   pYvsX16V->GetYaxis()->SetTitle("Y (m)");
04910   pYvsX16V->GetYaxis()->CenterTitle();
04911 
04912   TProfile2D* pYvsX16V1=new TProfile2D("pYvsX16V1","pYvsX16V1",
04913                                        16,-4,4,16,-4,4);
04914   pYvsX16V1->SetTitle("MEU");
04915   pYvsX16V1->GetXaxis()->SetTitle("X (m)");
04916   pYvsX16V1->GetXaxis()->CenterTitle();
04917   pYvsX16V1->GetYaxis()->SetTitle("Y (m)");
04918   pYvsX16V1->GetYaxis()->CenterTitle();
04919 
04920   TProfile2D* pYvsX16V2=new TProfile2D("pYvsX16V2","pYvsX16V2",
04921                                        16,-4,4,16,-4,4);
04922   pYvsX16V2->SetTitle("MEU");
04923   pYvsX16V2->GetXaxis()->SetTitle("X (m)");
04924   pYvsX16V2->GetXaxis()->CenterTitle();
04925   pYvsX16V2->GetYaxis()->SetTitle("Y (m)");
04926   pYvsX16V2->GetYaxis()->CenterTitle();
04927 
04928   //different quantities
04929   TProfile2D* pStsYvsX16U=new TProfile2D("pStsYvsX16U","pStsYvsX16U",
04930                                          16,-4,4,16,-4,4);
04931   pStsYvsX16U->SetTitle("MEU");
04932   pStsYvsX16U->GetXaxis()->SetTitle("X (m)");
04933   pStsYvsX16U->GetXaxis()->CenterTitle();
04934   pStsYvsX16U->GetYaxis()->SetTitle("Y (m)");
04935   pStsYvsX16U->GetYaxis()->CenterTitle();
04936   
04937   TProfile2D* pStsYvsX16U1=new TProfile2D("pStsYvsX16U1","pStsYvsX16U1",
04938                                           16,-4,4,16,-4,4);
04939   pStsYvsX16U1->SetTitle("MEU1");
04940   pStsYvsX16U1->GetXaxis()->SetTitle("X (m)");
04941   pStsYvsX16U1->GetXaxis()->CenterTitle();
04942   pStsYvsX16U1->GetYaxis()->SetTitle("Y (m)");
04943   pStsYvsX16U1->GetYaxis()->CenterTitle();
04944   
04945   TProfile2D* pStsYvsX16U2=new TProfile2D("pStsYvsX16U2","pStsYvsX16U2",
04946                                           16,-4,4,16,-4,4);
04947   pStsYvsX16U2->SetTitle("MEU2");
04948   pStsYvsX16U2->GetXaxis()->SetTitle("X (m)");
04949   pStsYvsX16U2->GetXaxis()->CenterTitle();
04950   pStsYvsX16U2->GetYaxis()->SetTitle("Y (m)");
04951   pStsYvsX16U2->GetYaxis()->CenterTitle();
04952 
04953   TProfile2D* pStsYvsX16U1Trk=new TProfile2D("pStsYvsX16U1Trk",
04954                                              "pStsYvsX16U1Trk",
04955                                              16,-4,4,16,-4,4);
04956   pStsYvsX16U1Trk->SetTitle("MEU");
04957   pStsYvsX16U1Trk->GetXaxis()->SetTitle("X (m)");
04958   pStsYvsX16U1Trk->GetXaxis()->CenterTitle();
04959   pStsYvsX16U1Trk->GetYaxis()->SetTitle("Y (m)");
04960   pStsYvsX16U1Trk->GetYaxis()->CenterTitle();
04961 
04962   TProfile2D* pStsYvsX16U2Trk=new TProfile2D("pStsYvsX16U2Trk",
04963                                              "pStsYvsX16U2Trk",
04964                                              16,-4,4,16,-4,4);
04965   pStsYvsX16U2Trk->SetTitle("MEU");
04966   pStsYvsX16U2Trk->GetXaxis()->SetTitle("X (m)");
04967   pStsYvsX16U2Trk->GetXaxis()->CenterTitle();
04968   pStsYvsX16U2Trk->GetYaxis()->SetTitle("Y (m)");
04969   pStsYvsX16U2Trk->GetYaxis()->CenterTitle();
04970 
04971   TProfile2D* pStsYvsX16V=new TProfile2D("pStsYvsX16V","pStsYvsX16V",
04972                                          16,-4,4,16,-4,4);
04973   pStsYvsX16V->SetTitle("MEU");
04974   pStsYvsX16V->GetXaxis()->SetTitle("X (m)");
04975   pStsYvsX16V->GetXaxis()->CenterTitle();
04976   pStsYvsX16V->GetYaxis()->SetTitle("Y (m)");
04977   pStsYvsX16V->GetYaxis()->CenterTitle();
04978 
04979   TProfile2D* pStsYvsX16V1=new TProfile2D("pStsYvsX16V1","pStsYvsX16V1",
04980                                           16,-4,4,16,-4,4);
04981   pStsYvsX16V1->SetTitle("MEU");
04982   pStsYvsX16V1->GetXaxis()->SetTitle("X (m)");
04983   pStsYvsX16V1->GetXaxis()->CenterTitle();
04984   pStsYvsX16V1->GetYaxis()->SetTitle("Y (m)");
04985   pStsYvsX16V1->GetYaxis()->CenterTitle();
04986 
04987   TProfile2D* pStsYvsX16V2=new TProfile2D("pStsYvsX16V2","pStsYvsX16V2",
04988                                           16,-4,4,16,-4,4);
04989   pStsYvsX16V2->SetTitle("MEU");
04990   pStsYvsX16V2->GetXaxis()->SetTitle("X (m)");
04991   pStsYvsX16V2->GetXaxis()->CenterTitle();
04992   pStsYvsX16V2->GetYaxis()->SetTitle("Y (m)");
04993   pStsYvsX16V2->GetYaxis()->CenterTitle();
04994 
04995   TProfile2D* pStsYvsX16V1Trk=new TProfile2D("pStsYvsX16V1Trk",
04996                                              "pStsYvsX16V1Trk",
04997                                              16,-4,4,16,-4,4);
04998   pStsYvsX16V1Trk->SetTitle("MEU");
04999   pStsYvsX16V1Trk->GetXaxis()->SetTitle("X (m)");
05000   pStsYvsX16V1Trk->GetXaxis()->CenterTitle();
05001   pStsYvsX16V1Trk->GetYaxis()->SetTitle("Y (m)");
05002   pStsYvsX16V1Trk->GetYaxis()->CenterTitle();
05003 
05004   TProfile2D* pStsYvsX16V2Trk=new TProfile2D("pStsYvsX16V2Trk",
05005                                              "pStsYvsX16V2Trk",
05006                                              16,-4,4,16,-4,4);
05007   pStsYvsX16V2Trk->SetTitle("MEU");
05008   pStsYvsX16V2Trk->GetXaxis()->SetTitle("X (m)");
05009   pStsYvsX16V2Trk->GetXaxis()->CenterTitle();
05010   pStsYvsX16V2Trk->GetYaxis()->SetTitle("Y (m)");
05011   pStsYvsX16V2Trk->GetYaxis()->CenterTitle();
05012 
05013   TProfile2D* pAdcYvsX16U=new TProfile2D("pAdcYvsX16U","pAdcYvsX16U",
05014                                          16,-4,4,16,-4,4);
05015   pAdcYvsX16U->SetTitle("MEU");
05016   pAdcYvsX16U->GetXaxis()->SetTitle("X (m)");
05017   pAdcYvsX16U->GetXaxis()->CenterTitle();
05018   pAdcYvsX16U->GetYaxis()->SetTitle("Y (m)");
05019   pAdcYvsX16U->GetYaxis()->CenterTitle();
05020 
05021   TProfile2D* pAdcYvsX16U1=new TProfile2D("pAdcYvsX16U1","pAdcYvsX16U1",
05022                                           16,-4,4,16,-4,4);
05023   pAdcYvsX16U1->SetTitle("MEU1");
05024   pAdcYvsX16U1->GetXaxis()->SetTitle("X (m)");
05025   pAdcYvsX16U1->GetXaxis()->CenterTitle();
05026   pAdcYvsX16U1->GetYaxis()->SetTitle("Y (m)");
05027   pAdcYvsX16U1->GetYaxis()->CenterTitle();
05028 
05029   TProfile2D* pAdcYvsX16U2=new TProfile2D("pAdcYvsX16U2","pAdcYvsX16U2",
05030                                           16,-4,4,16,-4,4);
05031   pAdcYvsX16U2->SetTitle("MEU2");
05032   pAdcYvsX16U2->GetXaxis()->SetTitle("X (m)");
05033   pAdcYvsX16U2->GetXaxis()->CenterTitle();
05034   pAdcYvsX16U2->GetYaxis()->SetTitle("Y (m)");
05035   pAdcYvsX16U2->GetYaxis()->CenterTitle();
05036   
05037   TProfile2D* pAdcYvsX16V=new TProfile2D("pAdcYvsX16V","pAdcYvsX16V",
05038                                          16,-4,4,16,-4,4);
05039   pAdcYvsX16V->SetTitle("MEU");
05040   pAdcYvsX16V->GetXaxis()->SetTitle("X (m)");
05041   pAdcYvsX16V->GetXaxis()->CenterTitle();
05042   pAdcYvsX16V->GetYaxis()->SetTitle("Y (m)");
05043   pAdcYvsX16V->GetYaxis()->CenterTitle();
05044 
05045   TProfile2D* pAdcYvsX16V1=new TProfile2D("pAdcYvsX16V1","pAdcYvsX16V1",
05046                                           16,-4,4,16,-4,4);
05047   pAdcYvsX16V1->SetTitle("MEU");
05048   pAdcYvsX16V1->GetXaxis()->SetTitle("X (m)");
05049   pAdcYvsX16V1->GetXaxis()->CenterTitle();
05050   pAdcYvsX16V1->GetYaxis()->SetTitle("Y (m)");
05051   pAdcYvsX16V1->GetYaxis()->CenterTitle();
05052 
05053   TProfile2D* pAdcYvsX16V2=new TProfile2D("pAdcYvsX16V2","pAdcYvsX16V2",
05054                                           16,-4,4,16,-4,4);
05055   pAdcYvsX16V2->SetTitle("MEU");
05056   pAdcYvsX16V2->GetXaxis()->SetTitle("X (m)");
05057   pAdcYvsX16V2->GetXaxis()->CenterTitle();
05058   pAdcYvsX16V2->GetYaxis()->SetTitle("Y (m)");
05059   pAdcYvsX16V2->GetYaxis()->CenterTitle();
05060 
05061   TProfile2D* pPeYvsX16U=new TProfile2D("pPeYvsX16U","pPeYvsX16U",
05062                                          16,-4,4,16,-4,4);
05063   pPeYvsX16U->SetTitle("MEU");
05064   pPeYvsX16U->GetXaxis()->SetTitle("X (m)");
05065   pPeYvsX16U->GetXaxis()->CenterTitle();
05066   pPeYvsX16U->GetYaxis()->SetTitle("Y (m)");
05067   pPeYvsX16U->GetYaxis()->CenterTitle();
05068 
05069   TProfile2D* pPeYvsX16U1=new TProfile2D("pPeYvsX16U1","pPeYvsX16U1",
05070                                           16,-4,4,16,-4,4);
05071   pPeYvsX16U1->SetTitle("MEU1");
05072   pPeYvsX16U1->GetXaxis()->SetTitle("X (m)");
05073   pPeYvsX16U1->GetXaxis()->CenterTitle();
05074   pPeYvsX16U1->GetYaxis()->SetTitle("Y (m)");
05075   pPeYvsX16U1->GetYaxis()->CenterTitle();
05076 
05077   TProfile2D* pPeYvsX16U2=new TProfile2D("pPeYvsX16U2","pPeYvsX16U2",
05078                                           16,-4,4,16,-4,4);
05079   pPeYvsX16U2->SetTitle("MEU2");
05080   pPeYvsX16U2->GetXaxis()->SetTitle("X (m)");
05081   pPeYvsX16U2->GetXaxis()->CenterTitle();
05082   pPeYvsX16U2->GetYaxis()->SetTitle("Y (m)");
05083   pPeYvsX16U2->GetYaxis()->CenterTitle();
05084   
05085   TProfile2D* pPeYvsX16V=new TProfile2D("pPeYvsX16V","pPeYvsX16V",
05086                                          16,-4,4,16,-4,4);
05087   pPeYvsX16V->SetTitle("MEU");
05088   pPeYvsX16V->GetXaxis()->SetTitle("X (m)");
05089   pPeYvsX16V->GetXaxis()->CenterTitle();
05090   pPeYvsX16V->GetYaxis()->SetTitle("Y (m)");
05091   pPeYvsX16V->GetYaxis()->CenterTitle();
05092 
05093   TProfile2D* pPeYvsX16V1=new TProfile2D("pPeYvsX16V1","pPeYvsX16V1",
05094                                           16,-4,4,16,-4,4);
05095   pPeYvsX16V1->SetTitle("MEU");
05096   pPeYvsX16V1->GetXaxis()->SetTitle("X (m)");
05097   pPeYvsX16V1->GetXaxis()->CenterTitle();
05098   pPeYvsX16V1->GetYaxis()->SetTitle("Y (m)");
05099   pPeYvsX16V1->GetYaxis()->CenterTitle();
05100 
05101   TProfile2D* pPeYvsX16V2=new TProfile2D("pPeYvsX16V2","pPeYvsX16V2",
05102                                           16,-4,4,16,-4,4);
05103   pPeYvsX16V2->SetTitle("MEU");
05104   pPeYvsX16V2->GetXaxis()->SetTitle("X (m)");
05105   pPeYvsX16V2->GetXaxis()->CenterTitle();
05106   pPeYvsX16V2->GetYaxis()->SetTitle("Y (m)");
05107   pPeYvsX16V2->GetYaxis()->CenterTitle();
05108 
05109 
05110 
05112   //30 bins
05113   TH2F* hYvsX30=new TH2F("hYvsX30","hYvsX30",30,-4,4,30,-4,4);
05114   hYvsX30->SetTitle("MEU");
05115   hYvsX30->GetXaxis()->SetTitle("X (m)");
05116   hYvsX30->GetXaxis()->CenterTitle();
05117   hYvsX30->GetYaxis()->SetTitle("Y (m)");
05118   hYvsX30->GetYaxis()->CenterTitle();
05119 
05120   TProfile2D* pYvsX30=new TProfile2D("pYvsX30","pYvsX30",
05121                                      30,-4,4,30,-4,4);
05122   pYvsX30->SetTitle("MEU");
05123   pYvsX30->GetXaxis()->SetTitle("X (m)");
05124   pYvsX30->GetXaxis()->CenterTitle();
05125   pYvsX30->GetYaxis()->SetTitle("Y (m)");
05126   pYvsX30->GetYaxis()->CenterTitle();
05127 
05128   TH2F* hYvsX30U=new TH2F("hYvsX30U","hYvsX30U",30,-4,4,30,-4,4);
05129   hYvsX30U->SetTitle("MEU");
05130   hYvsX30U->GetXaxis()->SetTitle("X (m)");
05131   hYvsX30U->GetXaxis()->CenterTitle();
05132   hYvsX30U->GetYaxis()->SetTitle("Y (m)");
05133   hYvsX30U->GetYaxis()->CenterTitle();
05134 
05135   TProfile2D* pYvsX30U=new TProfile2D("pYvsX30U","pYvsX30U",
05136                                       30,-4,4,30,-4,4);
05137   pYvsX30U->SetTitle("MEU");
05138   pYvsX30U->GetXaxis()->SetTitle("X (m)");
05139   pYvsX30U->GetXaxis()->CenterTitle();
05140   pYvsX30U->GetYaxis()->SetTitle("Y (m)");
05141   pYvsX30U->GetYaxis()->CenterTitle();
05142 
05143   TProfile2D* pYvsX30U1=new TProfile2D("pYvsX30U1","pYvsX30U1",
05144                                        30,-4,4,30,-4,4);
05145   pYvsX30U1->SetTitle("MEU1");
05146   pYvsX30U1->GetXaxis()->SetTitle("X (m)");
05147   pYvsX30U1->GetXaxis()->CenterTitle();
05148   pYvsX30U1->GetYaxis()->SetTitle("Y (m)");
05149   pYvsX30U1->GetYaxis()->CenterTitle();
05150 
05151   TProfile2D* pYvsX30U2=new TProfile2D("pYvsX30U2","pYvsX30U2",
05152                                        30,-4,4,30,-4,4);
05153   pYvsX30U2->SetTitle("MEU2");
05154   pYvsX30U2->GetXaxis()->SetTitle("X (m)");
05155   pYvsX30U2->GetXaxis()->CenterTitle();
05156   pYvsX30U2->GetYaxis()->SetTitle("Y (m)");
05157   pYvsX30U2->GetYaxis()->CenterTitle();
05158 
05159   TH2F* hYvsX30V=new TH2F("hYvsX30V","hYvsX30V",30,-4,4,30,-4,4);
05160   hYvsX30V->SetTitle("MEU");
05161   hYvsX30V->GetXaxis()->SetTitle("X (m)");
05162   hYvsX30V->GetXaxis()->CenterTitle();
05163   hYvsX30V->GetYaxis()->SetTitle("Y (m)");
05164   hYvsX30V->GetYaxis()->CenterTitle();
05165 
05166   TProfile2D* pYvsX30V=new TProfile2D("pYvsX30V","pYvsX30V",
05167                                       30,-4,4,30,-4,4);
05168   pYvsX30V->SetTitle("MEU");
05169   pYvsX30V->GetXaxis()->SetTitle("X (m)");
05170   pYvsX30V->GetXaxis()->CenterTitle();
05171   pYvsX30V->GetYaxis()->SetTitle("Y (m)");
05172   pYvsX30V->GetYaxis()->CenterTitle();
05173 
05174   TProfile2D* pYvsX30V1=new TProfile2D("pYvsX30V1","pYvsX30V1",
05175                                        30,-4,4,30,-4,4);
05176   pYvsX30V1->SetTitle("MEU");
05177   pYvsX30V1->GetXaxis()->SetTitle("X (m)");
05178   pYvsX30V1->GetXaxis()->CenterTitle();
05179   pYvsX30V1->GetYaxis()->SetTitle("Y (m)");
05180   pYvsX30V1->GetYaxis()->CenterTitle();
05181 
05182   TProfile2D* pYvsX30V2=new TProfile2D("pYvsX30V2","pYvsX30V2",
05183                                        30,-4,4,30,-4,4);
05184   pYvsX30V2->SetTitle("MEU");
05185   pYvsX30V2->GetXaxis()->SetTitle("X (m)");
05186   pYvsX30V2->GetXaxis()->CenterTitle();
05187   pYvsX30V2->GetYaxis()->SetTitle("Y (m)");
05188   pYvsX30V2->GetYaxis()->CenterTitle();
05189 
05190   //different quantities
05191   TProfile2D* pStsYvsX30U=new TProfile2D("pStsYvsX30U","pStsYvsX30U",
05192                                          30,-4,4,30,-4,4);
05193   pStsYvsX30U->SetTitle("MEU");
05194   pStsYvsX30U->GetXaxis()->SetTitle("X (m)");
05195   pStsYvsX30U->GetXaxis()->CenterTitle();
05196   pStsYvsX30U->GetYaxis()->SetTitle("Y (m)");
05197   pStsYvsX30U->GetYaxis()->CenterTitle();
05198   
05199   TProfile2D* pStsYvsX30U1=new TProfile2D("pStsYvsX30U1","pStsYvsX30U1",
05200                                           30,-4,4,30,-4,4);
05201   pStsYvsX30U1->SetTitle("MEU1");
05202   pStsYvsX30U1->GetXaxis()->SetTitle("X (m)");
05203   pStsYvsX30U1->GetXaxis()->CenterTitle();
05204   pStsYvsX30U1->GetYaxis()->SetTitle("Y (m)");
05205   pStsYvsX30U1->GetYaxis()->CenterTitle();
05206   
05207   TProfile2D* pStsYvsX30U2=new TProfile2D("pStsYvsX30U2","pStsYvsX30U2",
05208                                           30,-4,4,30,-4,4);
05209   pStsYvsX30U2->SetTitle("MEU2");
05210   pStsYvsX30U2->GetXaxis()->SetTitle("X (m)");
05211   pStsYvsX30U2->GetXaxis()->CenterTitle();
05212   pStsYvsX30U2->GetYaxis()->SetTitle("Y (m)");
05213   pStsYvsX30U2->GetYaxis()->CenterTitle();
05214 
05215   TProfile2D* pStsYvsX30U1Trk=new TProfile2D("pStsYvsX30U1Trk",
05216                                              "pStsYvsX30U1Trk",
05217                                              30,-4,4,30,-4,4);
05218   pStsYvsX30U1Trk->SetTitle("MEU");
05219   pStsYvsX30U1Trk->GetXaxis()->SetTitle("X (m)");
05220   pStsYvsX30U1Trk->GetXaxis()->CenterTitle();
05221   pStsYvsX30U1Trk->GetYaxis()->SetTitle("Y (m)");
05222   pStsYvsX30U1Trk->GetYaxis()->CenterTitle();
05223 
05224   TProfile2D* pStsYvsX30U2Trk=new TProfile2D("pStsYvsX30U2Trk",
05225                                              "pStsYvsX30U2Trk",
05226                                              30,-4,4,30,-4,4);
05227   pStsYvsX30U2Trk->SetTitle("MEU");
05228   pStsYvsX30U2Trk->GetXaxis()->SetTitle("X (m)");
05229   pStsYvsX30U2Trk->GetXaxis()->CenterTitle();
05230   pStsYvsX30U2Trk->GetYaxis()->SetTitle("Y (m)");
05231   pStsYvsX30U2Trk->GetYaxis()->CenterTitle();
05232 
05233   TProfile2D* pStsYvsX30V=new TProfile2D("pStsYvsX30V","pStsYvsX30V",
05234                                          30,-4,4,30,-4,4);
05235   pStsYvsX30V->SetTitle("MEU");
05236   pStsYvsX30V->GetXaxis()->SetTitle("X (m)");
05237   pStsYvsX30V->GetXaxis()->CenterTitle();
05238   pStsYvsX30V->GetYaxis()->SetTitle("Y (m)");
05239   pStsYvsX30V->GetYaxis()->CenterTitle();
05240 
05241   TProfile2D* pStsYvsX30V1=new TProfile2D("pStsYvsX30V1","pStsYvsX30V1",
05242                                           30,-4,4,30,-4,4);
05243   pStsYvsX30V1->SetTitle("MEU");
05244   pStsYvsX30V1->GetXaxis()->SetTitle("X (m)");
05245   pStsYvsX30V1->GetXaxis()->CenterTitle();
05246   pStsYvsX30V1->GetYaxis()->SetTitle("Y (m)");
05247   pStsYvsX30V1->GetYaxis()->CenterTitle();
05248 
05249   TProfile2D* pStsYvsX30V2=new TProfile2D("pStsYvsX30V2","pStsYvsX30V2",
05250                                           30,-4,4,30,-4,4);
05251   pStsYvsX30V2->SetTitle("MEU");
05252   pStsYvsX30V2->GetXaxis()->SetTitle("X (m)");
05253   pStsYvsX30V2->GetXaxis()->CenterTitle();
05254   pStsYvsX30V2->GetYaxis()->SetTitle("Y (m)");
05255   pStsYvsX30V2->GetYaxis()->CenterTitle();
05256 
05257   TProfile2D* pStsYvsX30V1Trk=new TProfile2D("pStsYvsX30V1Trk",
05258                                              "pStsYvsX30V1Trk",
05259                                              30,-4,4,30,-4,4);
05260   pStsYvsX30V1Trk->SetTitle("MEU");
05261   pStsYvsX30V1Trk->GetXaxis()->SetTitle("X (m)");
05262   pStsYvsX30V1Trk->GetXaxis()->CenterTitle();
05263   pStsYvsX30V1Trk->GetYaxis()->SetTitle("Y (m)");
05264   pStsYvsX30V1Trk->GetYaxis()->CenterTitle();
05265 
05266   TProfile2D* pStsYvsX30V2Trk=new TProfile2D("pStsYvsX30V2Trk",
05267                                              "pStsYvsX30V2Trk",
05268                                              30,-4,4,30,-4,4);
05269   pStsYvsX30V2Trk->SetTitle("MEU");
05270   pStsYvsX30V2Trk->GetXaxis()->SetTitle("X (m)");
05271   pStsYvsX30V2Trk->GetXaxis()->CenterTitle();
05272   pStsYvsX30V2Trk->GetYaxis()->SetTitle("Y (m)");
05273   pStsYvsX30V2Trk->GetYaxis()->CenterTitle();
05274 
05275   TProfile2D* pAdcYvsX30U=new TProfile2D("pAdcYvsX30U","pAdcYvsX30U",
05276                                          30,-4,4,30,-4,4);
05277   pAdcYvsX30U->SetTitle("MEU");
05278   pAdcYvsX30U->GetXaxis()->SetTitle("X (m)");
05279   pAdcYvsX30U->GetXaxis()->CenterTitle();
05280   pAdcYvsX30U->GetYaxis()->SetTitle("Y (m)");
05281   pAdcYvsX30U->GetYaxis()->CenterTitle();
05282 
05283   TProfile2D* pAdcYvsX30U1=new TProfile2D("pAdcYvsX30U1","pAdcYvsX30U1",
05284                                           30,-4,4,30,-4,4);
05285   pAdcYvsX30U1->SetTitle("MEU1");
05286   pAdcYvsX30U1->GetXaxis()->SetTitle("X (m)");
05287   pAdcYvsX30U1->GetXaxis()->CenterTitle();
05288   pAdcYvsX30U1->GetYaxis()->SetTitle("Y (m)");
05289   pAdcYvsX30U1->GetYaxis()->CenterTitle();
05290 
05291   TProfile2D* pAdcYvsX30U2=new TProfile2D("pAdcYvsX30U2","pAdcYvsX30U2",
05292                                           30,-4,4,30,-4,4);
05293   pAdcYvsX30U2->SetTitle("MEU2");
05294   pAdcYvsX30U2->GetXaxis()->SetTitle("X (m)");
05295   pAdcYvsX30U2->GetXaxis()->CenterTitle();
05296   pAdcYvsX30U2->GetYaxis()->SetTitle("Y (m)");
05297   pAdcYvsX30U2->GetYaxis()->CenterTitle();
05298   
05299   TProfile2D* pAdcYvsX30V=new TProfile2D("pAdcYvsX30V","pAdcYvsX30V",
05300                                          30,-4,4,30,-4,4);
05301   pAdcYvsX30V->SetTitle("MEU");
05302   pAdcYvsX30V->GetXaxis()->SetTitle("X (m)");
05303   pAdcYvsX30V->GetXaxis()->CenterTitle();
05304   pAdcYvsX30V->GetYaxis()->SetTitle("Y (m)");
05305   pAdcYvsX30V->GetYaxis()->CenterTitle();
05306 
05307   TProfile2D* pAdcYvsX30V1=new TProfile2D("pAdcYvsX30V1","pAdcYvsX30V1",
05308                                           30,-4,4,30,-4,4);
05309   pAdcYvsX30V1->SetTitle("MEU");
05310   pAdcYvsX30V1->GetXaxis()->SetTitle("X (m)");
05311   pAdcYvsX30V1->GetXaxis()->CenterTitle();
05312   pAdcYvsX30V1->GetYaxis()->SetTitle("Y (m)");
05313   pAdcYvsX30V1->GetYaxis()->CenterTitle();
05314 
05315   TProfile2D* pAdcYvsX30V2=new TProfile2D("pAdcYvsX30V2","pAdcYvsX30V2",
05316                                           30,-4,4,30,-4,4);
05317   pAdcYvsX30V2->SetTitle("MEU");
05318   pAdcYvsX30V2->GetXaxis()->SetTitle("X (m)");
05319   pAdcYvsX30V2->GetXaxis()->CenterTitle();
05320   pAdcYvsX30V2->GetYaxis()->SetTitle("Y (m)");
05321   pAdcYvsX30V2->GetYaxis()->CenterTitle();
05322 
05323   TProfile2D* pPeYvsX30U=new TProfile2D("pPeYvsX30U","pPeYvsX30U",
05324                                          30,-4,4,30,-4,4);
05325   pPeYvsX30U->SetTitle("MEU");
05326   pPeYvsX30U->GetXaxis()->SetTitle("X (m)");
05327   pPeYvsX30U->GetXaxis()->CenterTitle();
05328   pPeYvsX30U->GetYaxis()->SetTitle("Y (m)");
05329   pPeYvsX30U->GetYaxis()->CenterTitle();
05330 
05331   TProfile2D* pPeYvsX30U1=new TProfile2D("pPeYvsX30U1","pPeYvsX30U1",
05332                                           30,-4,4,30,-4,4);
05333   pPeYvsX30U1->SetTitle("MEU1");
05334   pPeYvsX30U1->GetXaxis()->SetTitle("X (m)");
05335   pPeYvsX30U1->GetXaxis()->CenterTitle();
05336   pPeYvsX30U1->GetYaxis()->SetTitle("Y (m)");
05337   pPeYvsX30U1->GetYaxis()->CenterTitle();
05338 
05339   TProfile2D* pPeYvsX30U2=new TProfile2D("pPeYvsX30U2","pPeYvsX30U2",
05340                                           30,-4,4,30,-4,4);
05341   pPeYvsX30U2->SetTitle("MEU2");
05342   pPeYvsX30U2->GetXaxis()->SetTitle("X (m)");
05343   pPeYvsX30U2->GetXaxis()->CenterTitle();
05344   pPeYvsX30U2->GetYaxis()->SetTitle("Y (m)");
05345   pPeYvsX30U2->GetYaxis()->CenterTitle();
05346   
05347   TProfile2D* pPeYvsX30V=new TProfile2D("pPeYvsX30V","pPeYvsX30V",
05348                                          30,-4,4,30,-4,4);
05349   pPeYvsX30V->SetTitle("MEU");
05350   pPeYvsX30V->GetXaxis()->SetTitle("X (m)");
05351   pPeYvsX30V->GetXaxis()->CenterTitle();
05352   pPeYvsX30V->GetYaxis()->SetTitle("Y (m)");
05353   pPeYvsX30V->GetYaxis()->CenterTitle();
05354 
05355   TProfile2D* pPeYvsX30V1=new TProfile2D("pPeYvsX30V1","pPeYvsX30V1",
05356                                           30,-4,4,30,-4,4);
05357   pPeYvsX30V1->SetTitle("MEU");
05358   pPeYvsX30V1->GetXaxis()->SetTitle("X (m)");
05359   pPeYvsX30V1->GetXaxis()->CenterTitle();
05360   pPeYvsX30V1->GetYaxis()->SetTitle("Y (m)");
05361   pPeYvsX30V1->GetYaxis()->CenterTitle();
05362 
05363   TProfile2D* pPeYvsX30V2=new TProfile2D("pPeYvsX30V2","pPeYvsX30V2",
05364                                           30,-4,4,30,-4,4);
05365   pPeYvsX30V2->SetTitle("MEU");
05366   pPeYvsX30V2->GetXaxis()->SetTitle("X (m)");
05367   pPeYvsX30V2->GetXaxis()->CenterTitle();
05368   pPeYvsX30V2->GetYaxis()->SetTitle("Y (m)");
05369   pPeYvsX30V2->GetYaxis()->CenterTitle();
05370 
05371 
05373   Int_t nYvsX60=60;
05374   TH2F* hYvsX=new TH2F("hYvsX","hYvsX",nYvsX60,-4,4,nYvsX60,-4,4);
05375   hYvsX->SetTitle("MEU");
05376   hYvsX->GetXaxis()->SetTitle("X (m)");
05377   hYvsX->GetXaxis()->CenterTitle();
05378   hYvsX->GetYaxis()->SetTitle("Y (m)");
05379   hYvsX->GetYaxis()->CenterTitle();
05380 
05381   TH2F* hYvsXVtx=new TH2F
05382     ("hYvsXVtx","hYvsXVtx",nYvsX60,-4,4,nYvsX60,-4,4);
05383   hYvsXVtx->SetTitle("MEU");
05384   hYvsXVtx->GetXaxis()->SetTitle("X (m)");
05385   hYvsXVtx->GetXaxis()->CenterTitle();
05386   hYvsXVtx->GetYaxis()->SetTitle("Y (m)");
05387   hYvsXVtx->GetYaxis()->CenterTitle();
05388 
05389   TH2F* hYvsXEnd=new TH2F
05390     ("hYvsXEnd","hYvsXEnd",nYvsX60,-4,4,nYvsX60,-4,4);
05391   hYvsXEnd->SetTitle("MEU");
05392   hYvsXEnd->GetXaxis()->SetTitle("X (m)");
05393   hYvsXEnd->GetXaxis()->CenterTitle();
05394   hYvsXEnd->GetYaxis()->SetTitle("Y (m)");
05395   hYvsXEnd->GetYaxis()->CenterTitle();
05396 
05397   TProfile2D* pYvsX=new TProfile2D
05398     ("pYvsX","pYvsX",nYvsX60,-4,4,nYvsX60,-4,4);
05399   pYvsX->SetTitle("MEU");
05400   pYvsX->GetXaxis()->SetTitle("X (m)");
05401   pYvsX->GetXaxis()->CenterTitle();
05402   pYvsX->GetYaxis()->SetTitle("Y (m)");
05403   pYvsX->GetYaxis()->CenterTitle();
05404 
05405   TProfile2D* pAdcYvsX=new TProfile2D
05406     ("pAdcYvsX","pAdcYvsX",nYvsX60,-4,4,nYvsX60,-4,4);
05407   pAdcYvsX->SetTitle("MEU");
05408   pAdcYvsX->GetXaxis()->SetTitle("X (m)");
05409   pAdcYvsX->GetXaxis()->CenterTitle();
05410   pAdcYvsX->GetYaxis()->SetTitle("Y (m)");
05411   pAdcYvsX->GetYaxis()->CenterTitle();
05412 
05413   TProfile2D* pStsYvsX=new TProfile2D
05414     ("pStsYvsX","pStsYvsX",nYvsX60,-4,4,nYvsX60,-4,4);
05415   pStsYvsX->SetTitle("MEU");
05416   pStsYvsX->GetXaxis()->SetTitle("X (m)");
05417   pStsYvsX->GetXaxis()->CenterTitle();
05418   pStsYvsX->GetYaxis()->SetTitle("Y (m)");
05419   pStsYvsX->GetYaxis()->CenterTitle();
05420 
05421   TProfile2D* pPeYvsX=new TProfile2D
05422     ("pPeYvsX","pPeYvsX",nYvsX60,-4,4,nYvsX60,-4,4);
05423   pPeYvsX->SetTitle("MEU");
05424   pPeYvsX->GetXaxis()->SetTitle("X (m)");
05425   pPeYvsX->GetXaxis()->CenterTitle();
05426   pPeYvsX->GetYaxis()->SetTitle("Y (m)");
05427   pPeYvsX->GetYaxis()->CenterTitle();
05428 
05429   TH2F* hYvsXU=new TH2F
05430     ("hYvsXU","hYvsXU",nYvsX60,-4,4,nYvsX60,-4,4);
05431   hYvsXU->SetTitle("MEU");
05432   hYvsXU->GetXaxis()->SetTitle("X (m)");
05433   hYvsXU->GetXaxis()->CenterTitle();
05434   hYvsXU->GetYaxis()->SetTitle("Y (m)");
05435   hYvsXU->GetYaxis()->CenterTitle();
05436 
05437   TProfile2D* pYvsXU=new TProfile2D
05438     ("pYvsXU","pYvsXU",nYvsX60,-4,4,nYvsX60,-4,4);
05439   pYvsXU->SetTitle("MEU");
05440   pYvsXU->GetXaxis()->SetTitle("X (m)");
05441   pYvsXU->GetXaxis()->CenterTitle();
05442   pYvsXU->GetYaxis()->SetTitle("Y (m)");
05443   pYvsXU->GetYaxis()->CenterTitle();
05444 
05445   TProfile2D* pYvsXU1=new TProfile2D
05446     ("pYvsXU1","pYvsXU1",nYvsX60,-4,4,nYvsX60,-4,4);
05447   pYvsXU1->SetTitle("MEU1");
05448   pYvsXU1->GetXaxis()->SetTitle("X (m)");
05449   pYvsXU1->GetXaxis()->CenterTitle();
05450   pYvsXU1->GetYaxis()->SetTitle("Y (m)");
05451   pYvsXU1->GetYaxis()->CenterTitle();
05452 
05453   TProfile2D* pYvsXU2=new TProfile2D
05454     ("pYvsXU2","pYvsXU2",nYvsX60,-4,4,nYvsX60,-4,4);
05455   pYvsXU2->SetTitle("MEU2");
05456   pYvsXU2->GetXaxis()->SetTitle("X (m)");
05457   pYvsXU2->GetXaxis()->CenterTitle();
05458   pYvsXU2->GetYaxis()->SetTitle("Y (m)");
05459   pYvsXU2->GetYaxis()->CenterTitle();
05460 
05461   TH2F* hYvsXV=new TH2F
05462     ("hYvsXV","hYvsXV",nYvsX60,-4,4,nYvsX60,-4,4);
05463   hYvsXV->SetTitle("MEU");
05464   hYvsXV->GetXaxis()->SetTitle("X (m)");
05465   hYvsXV->GetXaxis()->CenterTitle();
05466   hYvsXV->GetYaxis()->SetTitle("Y (m)");
05467   hYvsXV->GetYaxis()->CenterTitle();
05468 
05469   TProfile2D* pYvsXV=new TProfile2D("pYvsXV","pYvsXV",
05470                                     nYvsX60,-4,4,nYvsX60,-4,4);
05471   pYvsXV->SetTitle("MEU");
05472   pYvsXV->GetXaxis()->SetTitle("X (m)");
05473   pYvsXV->GetXaxis()->CenterTitle();
05474   pYvsXV->GetYaxis()->SetTitle("Y (m)");
05475   pYvsXV->GetYaxis()->CenterTitle();
05476 
05477   TProfile2D* pYvsXV1=new TProfile2D("pYvsXV1","pYvsXV1",
05478                                      nYvsX60,-4,4,nYvsX60,-4,4);
05479   pYvsXV1->SetTitle("MEU");
05480   pYvsXV1->GetXaxis()->SetTitle("X (m)");
05481   pYvsXV1->GetXaxis()->CenterTitle();
05482   pYvsXV1->GetYaxis()->SetTitle("Y (m)");
05483   pYvsXV1->GetYaxis()->CenterTitle();
05484 
05485   TProfile2D* pYvsXV2=new TProfile2D("pYvsXV2","pYvsXV2",
05486                                      nYvsX60,-4,4,nYvsX60,-4,4);
05487   pYvsXV2->SetTitle("MEU");
05488   pYvsXV2->GetXaxis()->SetTitle("X (m)");
05489   pYvsXV2->GetXaxis()->CenterTitle();
05490   pYvsXV2->GetYaxis()->SetTitle("Y (m)");
05491   pYvsXV2->GetYaxis()->CenterTitle();
05492 
05493   TProfile2D* pStsYvsXU=new TProfile2D("pStsYvsXU","pStsYvsXU",
05494                                        nYvsX60,-4,4,nYvsX60,-4,4);
05495   pStsYvsXU->SetTitle("MEU");
05496   pStsYvsXU->GetXaxis()->SetTitle("X (m)");
05497   pStsYvsXU->GetXaxis()->CenterTitle();
05498   pStsYvsXU->GetYaxis()->SetTitle("Y (m)");
05499   pStsYvsXU->GetYaxis()->CenterTitle();
05500   
05501   TProfile2D* pStsYvsXU1=new TProfile2D("pStsYvsXU1","pStsYvsXU1",
05502                                         nYvsX60,-4,4,nYvsX60,-4,4);
05503   pStsYvsXU1->SetTitle("MEU1");
05504   pStsYvsXU1->GetXaxis()->SetTitle("X (m)");
05505   pStsYvsXU1->GetXaxis()->CenterTitle();
05506   pStsYvsXU1->GetYaxis()->SetTitle("Y (m)");
05507   pStsYvsXU1->GetYaxis()->CenterTitle();
05508   
05509   TProfile2D* pStsYvsXU2=new TProfile2D("pStsYvsXU2","pStsYvsXU2",
05510                                         nYvsX60,-4,4,nYvsX60,-4,4);
05511   pStsYvsXU2->SetTitle("MEU2");
05512   pStsYvsXU2->GetXaxis()->SetTitle("X (m)");
05513   pStsYvsXU2->GetXaxis()->CenterTitle();
05514   pStsYvsXU2->GetYaxis()->SetTitle("Y (m)");
05515   pStsYvsXU2->GetYaxis()->CenterTitle();
05516 
05517   TProfile2D* pStsYvsXU1Trk=new TProfile2D("pStsYvsXU1Trk",
05518                                            "pStsYvsXU1Trk",
05519                                            nYvsX60,-4,4,nYvsX60,-4,4);
05520   pStsYvsXU1Trk->SetTitle("MEU");
05521   pStsYvsXU1Trk->GetXaxis()->SetTitle("X (m)");
05522   pStsYvsXU1Trk->GetXaxis()->CenterTitle();
05523   pStsYvsXU1Trk->GetYaxis()->SetTitle("Y (m)");
05524   pStsYvsXU1Trk->GetYaxis()->CenterTitle();
05525 
05526   TProfile2D* pStsYvsXU2Trk=new TProfile2D("pStsYvsXU2Trk",
05527                                            "pStsYvsXU2Trk",
05528                                            nYvsX60,-4,4,nYvsX60,-4,4);
05529   pStsYvsXU2Trk->SetTitle("MEU");
05530   pStsYvsXU2Trk->GetXaxis()->SetTitle("X (m)");
05531   pStsYvsXU2Trk->GetXaxis()->CenterTitle();
05532   pStsYvsXU2Trk->GetYaxis()->SetTitle("Y (m)");
05533   pStsYvsXU2Trk->GetYaxis()->CenterTitle();
05534 
05535   TProfile2D* pStsYvsXV=new TProfile2D("pStsYvsXV","pStsYvsXV",
05536                                        nYvsX60,-4,4,nYvsX60,-4,4);
05537   pStsYvsXV->SetTitle("MEU");
05538   pStsYvsXV->GetXaxis()->SetTitle("X (m)");
05539   pStsYvsXV->GetXaxis()->CenterTitle();
05540   pStsYvsXV->GetYaxis()->SetTitle("Y (m)");
05541   pStsYvsXV->GetYaxis()->CenterTitle();
05542 
05543   TProfile2D* pStsYvsXV1=new TProfile2D("pStsYvsXV1","pStsYvsXV1",
05544                                         nYvsX60,-4,4,nYvsX60,-4,4);
05545   pStsYvsXV1->SetTitle("MEU");
05546   pStsYvsXV1->GetXaxis()->SetTitle("X (m)");
05547   pStsYvsXV1->GetXaxis()->CenterTitle();
05548   pStsYvsXV1->GetYaxis()->SetTitle("Y (m)");
05549   pStsYvsXV1->GetYaxis()->CenterTitle();
05550 
05551   TProfile2D* pStsYvsXV2=new TProfile2D("pStsYvsXV2","pStsYvsXV2",
05552                                         nYvsX60,-4,4,nYvsX60,-4,4);
05553   pStsYvsXV2->SetTitle("MEU");
05554   pStsYvsXV2->GetXaxis()->SetTitle("X (m)");
05555   pStsYvsXV2->GetXaxis()->CenterTitle();
05556   pStsYvsXV2->GetYaxis()->SetTitle("Y (m)");
05557   pStsYvsXV2->GetYaxis()->CenterTitle();
05558 
05559   TProfile2D* pStsYvsXV1Trk=new TProfile2D("pStsYvsXV1Trk",
05560                                            "pStsYvsXV1Trk",
05561                                            nYvsX60,-4,4,nYvsX60,-4,4);
05562   pStsYvsXV1Trk->SetTitle("MEU");
05563   pStsYvsXV1Trk->GetXaxis()->SetTitle("X (m)");
05564   pStsYvsXV1Trk->GetXaxis()->CenterTitle();
05565   pStsYvsXV1Trk->GetYaxis()->SetTitle("Y (m)");
05566   pStsYvsXV1Trk->GetYaxis()->CenterTitle();
05567 
05568   TProfile2D* pStsYvsXV2Trk=new TProfile2D("pStsYvsXV2Trk",
05569                                            "pStsYvsXV2Trk",
05570                                            nYvsX60,-4,4,nYvsX60,-4,4);
05571   pStsYvsXV2Trk->SetTitle("MEU");
05572   pStsYvsXV2Trk->GetXaxis()->SetTitle("X (m)");
05573   pStsYvsXV2Trk->GetXaxis()->CenterTitle();
05574   pStsYvsXV2Trk->GetYaxis()->SetTitle("Y (m)");
05575   pStsYvsXV2Trk->GetYaxis()->CenterTitle();
05576 
05577   TProfile2D* pAdcYvsXU=new TProfile2D("pAdcYvsXU","pAdcYvsXU",
05578                                        nYvsX60,-4,4,nYvsX60,-4,4);
05579   pAdcYvsXU->SetTitle("MEU");
05580   pAdcYvsXU->GetXaxis()->SetTitle("X (m)");
05581   pAdcYvsXU->GetXaxis()->CenterTitle();
05582   pAdcYvsXU->GetYaxis()->SetTitle("Y (m)");
05583   pAdcYvsXU->GetYaxis()->CenterTitle();
05584 
05585   TProfile2D* pAdcYvsXU1=new TProfile2D("pAdcYvsXU1","pAdcYvsXU1",
05586                                         nYvsX60,-4,4,nYvsX60,-4,4);
05587   pAdcYvsXU1->SetTitle("MEU1");
05588   pAdcYvsXU1->GetXaxis()->SetTitle("X (m)");
05589   pAdcYvsXU1->GetXaxis()->CenterTitle();
05590   pAdcYvsXU1->GetYaxis()->SetTitle("Y (m)");
05591   pAdcYvsXU1->GetYaxis()->CenterTitle();
05592 
05593   TProfile2D* pAdcYvsXU2=new TProfile2D("pAdcYvsXU2","pAdcYvsXU2",
05594                                         nYvsX60,-4,4,nYvsX60,-4,4);
05595   pAdcYvsXU2->SetTitle("MEU2");
05596   pAdcYvsXU2->GetXaxis()->SetTitle("X (m)");
05597   pAdcYvsXU2->GetXaxis()->CenterTitle();
05598   pAdcYvsXU2->GetYaxis()->SetTitle("Y (m)");
05599   pAdcYvsXU2->GetYaxis()->CenterTitle();
05600   
05601   TProfile2D* pAdcYvsXV=new TProfile2D("pAdcYvsXV","pAdcYvsXV",
05602                                        nYvsX60,-4,4,nYvsX60,-4,4);
05603   pAdcYvsXV->SetTitle("MEU");
05604   pAdcYvsXV->GetXaxis()->SetTitle("X (m)");
05605   pAdcYvsXV->GetXaxis()->CenterTitle();
05606   pAdcYvsXV->GetYaxis()->SetTitle("Y (m)");
05607   pAdcYvsXV->GetYaxis()->CenterTitle();
05608 
05609   TProfile2D* pAdcYvsXV1=new TProfile2D("pAdcYvsXV1","pAdcYvsXV1",
05610                                         nYvsX60,-4,4,nYvsX60,-4,4);
05611   pAdcYvsXV1->SetTitle("MEU");
05612   pAdcYvsXV1->GetXaxis()->SetTitle("X (m)");
05613   pAdcYvsXV1->GetXaxis()->CenterTitle();
05614   pAdcYvsXV1->GetYaxis()->SetTitle("Y (m)");
05615   pAdcYvsXV1->GetYaxis()->CenterTitle();
05616 
05617   TProfile2D* pAdcYvsXV2=new TProfile2D("pAdcYvsXV2","pAdcYvsXV2",
05618                                         nYvsX60,-4,4,nYvsX60,-4,4);
05619   pAdcYvsXV2->SetTitle("MEU");
05620   pAdcYvsXV2->GetXaxis()->SetTitle("X (m)");
05621   pAdcYvsXV2->GetXaxis()->CenterTitle();
05622   pAdcYvsXV2->GetYaxis()->SetTitle("Y (m)");
05623   pAdcYvsXV2->GetYaxis()->CenterTitle();
05624   
05625   TProfile2D* pPeYvsXU=new TProfile2D("pPeYvsXU","pPeYvsXU",
05626                                        nYvsX60,-4,4,nYvsX60,-4,4);
05627   pPeYvsXU->SetTitle("MEU");
05628   pPeYvsXU->GetXaxis()->SetTitle("X (m)");
05629   pPeYvsXU->GetXaxis()->CenterTitle();
05630   pPeYvsXU->GetYaxis()->SetTitle("Y (m)");
05631   pPeYvsXU->GetYaxis()->CenterTitle();
05632 
05633   TProfile2D* pPeYvsXU1=new TProfile2D("pPeYvsXU1","pPeYvsXU1",
05634                                         nYvsX60,-4,4,nYvsX60,-4,4);
05635   pPeYvsXU1->SetTitle("MEU1");
05636   pPeYvsXU1->GetXaxis()->SetTitle("X (m)");
05637   pPeYvsXU1->GetXaxis()->CenterTitle();
05638   pPeYvsXU1->GetYaxis()->SetTitle("Y (m)");
05639   pPeYvsXU1->GetYaxis()->CenterTitle();
05640 
05641   TProfile2D* pPeYvsXU2=new TProfile2D("pPeYvsXU2","pPeYvsXU2",
05642                                         nYvsX60,-4,4,nYvsX60,-4,4);
05643   pPeYvsXU2->SetTitle("MEU2");
05644   pPeYvsXU2->GetXaxis()->SetTitle("X (m)");
05645   pPeYvsXU2->GetXaxis()->CenterTitle();
05646   pPeYvsXU2->GetYaxis()->SetTitle("Y (m)");
05647   pPeYvsXU2->GetYaxis()->CenterTitle();
05648   
05649   TProfile2D* pPeYvsXV=new TProfile2D("pPeYvsXV","pPeYvsXV",
05650                                        nYvsX60,-4,4,nYvsX60,-4,4);
05651   pPeYvsXV->SetTitle("MEU");
05652   pPeYvsXV->GetXaxis()->SetTitle("X (m)");
05653   pPeYvsXV->GetXaxis()->CenterTitle();
05654   pPeYvsXV->GetYaxis()->SetTitle("Y (m)");
05655   pPeYvsXV->GetYaxis()->CenterTitle();
05656 
05657   TProfile2D* pPeYvsXV1=new TProfile2D("pPeYvsXV1","pPeYvsXV1",
05658                                         nYvsX60,-4,4,nYvsX60,-4,4);
05659   pPeYvsXV1->SetTitle("MEU");
05660   pPeYvsXV1->GetXaxis()->SetTitle("X (m)");
05661   pPeYvsXV1->GetXaxis()->CenterTitle();
05662   pPeYvsXV1->GetYaxis()->SetTitle("Y (m)");
05663   pPeYvsXV1->GetYaxis()->CenterTitle();
05664 
05665   TProfile2D* pPeYvsXV2=new TProfile2D("pPeYvsXV2","pPeYvsXV2",
05666                                         nYvsX60,-4,4,nYvsX60,-4,4);
05667   pPeYvsXV2->SetTitle("MEU");
05668   pPeYvsXV2->GetXaxis()->SetTitle("X (m)");
05669   pPeYvsXV2->GetXaxis()->CenterTitle();
05670   pPeYvsXV2->GetYaxis()->SetTitle("Y (m)");
05671   pPeYvsXV2->GetYaxis()->CenterTitle();
05672 
05673   
05674   //FULL planes
05676   TH2F* hYvsXF=new TH2F("hYvsXF","hYvsXF",nYvsX60,-4,4,nYvsX60,-4,4);
05677   hYvsXF->SetTitle("MEU");
05678   hYvsXF->GetXaxis()->SetTitle("X (m)");
05679   hYvsXF->GetXaxis()->CenterTitle();
05680   hYvsXF->GetYaxis()->SetTitle("Y (m)");
05681   hYvsXF->GetYaxis()->CenterTitle();
05682 
05683   TH2F* hYvsXFVtx=new TH2F
05684     ("hYvsXFVtx","hYvsXFVtx",nYvsX60,-4,4,nYvsX60,-4,4);
05685   hYvsXFVtx->SetTitle("MEU");
05686   hYvsXFVtx->GetXaxis()->SetTitle("X (m)");
05687   hYvsXFVtx->GetXaxis()->CenterTitle();
05688   hYvsXFVtx->GetYaxis()->SetTitle("Y (m)");
05689   hYvsXFVtx->GetYaxis()->CenterTitle();
05690 
05691   TH2F* hYvsXFEnd=new TH2F
05692     ("hYvsXFEnd","hYvsXFEnd",nYvsX60,-4,4,nYvsX60,-4,4);
05693   hYvsXFEnd->SetTitle("MEU");
05694   hYvsXFEnd->GetXaxis()->SetTitle("X (m)");
05695   hYvsXFEnd->GetXaxis()->CenterTitle();
05696   hYvsXFEnd->GetYaxis()->SetTitle("Y (m)");
05697   hYvsXFEnd->GetYaxis()->CenterTitle();
05698 
05699   TProfile2D* pYvsXF=new TProfile2D
05700     ("pYvsXF","pYvsXF",nYvsX60,-4,4,nYvsX60,-4,4);
05701   pYvsXF->SetTitle("MEU");
05702   pYvsXF->GetXaxis()->SetTitle("X (m)");
05703   pYvsXF->GetXaxis()->CenterTitle();
05704   pYvsXF->GetYaxis()->SetTitle("Y (m)");
05705   pYvsXF->GetYaxis()->CenterTitle();
05706 
05707   TH2F* hYvsXFU=new TH2F
05708     ("hYvsXFU","hYvsXFU",nYvsX60,-4,4,nYvsX60,-4,4);
05709   hYvsXFU->SetTitle("MEU");
05710   hYvsXFU->GetXaxis()->SetTitle("X (m)");
05711   hYvsXFU->GetXaxis()->CenterTitle();
05712   hYvsXFU->GetYaxis()->SetTitle("Y (m)");
05713   hYvsXFU->GetYaxis()->CenterTitle();
05714 
05715   TProfile2D* pYvsXFU=new TProfile2D
05716     ("pYvsXFU","pYvsXFU",nYvsX60,-4,4,nYvsX60,-4,4);
05717   pYvsXFU->SetTitle("MEU");
05718   pYvsXFU->GetXaxis()->SetTitle("X (m)");
05719   pYvsXFU->GetXaxis()->CenterTitle();
05720   pYvsXFU->GetYaxis()->SetTitle("Y (m)");
05721   pYvsXFU->GetYaxis()->CenterTitle();
05722 
05723   TProfile2D* pYvsXFU1=new TProfile2D
05724     ("pYvsXFU1","pYvsXFU1",nYvsX60,-4,4,nYvsX60,-4,4);
05725   pYvsXFU1->SetTitle("MEU1");
05726   pYvsXFU1->GetXaxis()->SetTitle("X (m)");
05727   pYvsXFU1->GetXaxis()->CenterTitle();
05728   pYvsXFU1->GetYaxis()->SetTitle("Y (m)");
05729   pYvsXFU1->GetYaxis()->CenterTitle();
05730 
05731   TProfile2D* pYvsXFU2=new TProfile2D
05732     ("pYvsXFU2","pYvsXFU2",nYvsX60,-4,4,nYvsX60,-4,4);
05733   pYvsXFU2->SetTitle("MEU2");
05734   pYvsXFU2->GetXaxis()->SetTitle("X (m)");
05735   pYvsXFU2->GetXaxis()->CenterTitle();
05736   pYvsXFU2->GetYaxis()->SetTitle("Y (m)");
05737   pYvsXFU2->GetYaxis()->CenterTitle();
05738 
05739   TH2F* hYvsXFV=new TH2F
05740     ("hYvsXFV","hYvsXFV",nYvsX60,-4,4,nYvsX60,-4,4);
05741   hYvsXFV->SetTitle("MEU");
05742   hYvsXFV->GetXaxis()->SetTitle("X (m)");
05743   hYvsXFV->GetXaxis()->CenterTitle();
05744   hYvsXFV->GetYaxis()->SetTitle("Y (m)");
05745   hYvsXFV->GetYaxis()->CenterTitle();
05746 
05747   TProfile2D* pYvsXFV=new TProfile2D("pYvsXFV","pYvsXFV",
05748                                      nYvsX60,-4,4,nYvsX60,-4,4);
05749   pYvsXFV->SetTitle("MEU");
05750   pYvsXFV->GetXaxis()->SetTitle("X (m)");
05751   pYvsXFV->GetXaxis()->CenterTitle();
05752   pYvsXFV->GetYaxis()->SetTitle("Y (m)");
05753   pYvsXFV->GetYaxis()->CenterTitle();
05754 
05755   TProfile2D* pYvsXFV1=new TProfile2D("pYvsXFV1","pYvsXFV1",
05756                                       nYvsX60,-4,4,nYvsX60,-4,4);
05757   pYvsXFV1->SetTitle("MEU");
05758   pYvsXFV1->GetXaxis()->SetTitle("X (m)");
05759   pYvsXFV1->GetXaxis()->CenterTitle();
05760   pYvsXFV1->GetYaxis()->SetTitle("Y (m)");
05761   pYvsXFV1->GetYaxis()->CenterTitle();
05762 
05763   TProfile2D* pYvsXFV2=new TProfile2D("pYvsXFV2","pYvsXFV2",
05764                                       nYvsX60,-4,4,nYvsX60,-4,4);
05765   pYvsXFV2->SetTitle("MEU");
05766   pYvsXFV2->GetXaxis()->SetTitle("X (m)");
05767   pYvsXFV2->GetXaxis()->CenterTitle();
05768   pYvsXFV2->GetYaxis()->SetTitle("Y (m)");
05769   pYvsXFV2->GetYaxis()->CenterTitle();
05770 
05771   TProfile2D* pStsYvsXFU=new TProfile2D("pStsYvsXFU","pStsYvsXFU",
05772                                         nYvsX60,-4,4,nYvsX60,-4,4);
05773   pStsYvsXFU->SetTitle("MEU");
05774   pStsYvsXFU->GetXaxis()->SetTitle("X (m)");
05775   pStsYvsXFU->GetXaxis()->CenterTitle();
05776   pStsYvsXFU->GetYaxis()->SetTitle("Y (m)");
05777   pStsYvsXFU->GetYaxis()->CenterTitle();
05778   
05779   TProfile2D* pStsYvsXFU1=new TProfile2D("pStsYvsXFU1","pStsYvsXFU1",
05780                                          nYvsX60,-4,4,nYvsX60,-4,4);
05781   pStsYvsXFU1->SetTitle("MEU1");
05782   pStsYvsXFU1->GetXaxis()->SetTitle("X (m)");
05783   pStsYvsXFU1->GetXaxis()->CenterTitle();
05784   pStsYvsXFU1->GetYaxis()->SetTitle("Y (m)");
05785   pStsYvsXFU1->GetYaxis()->CenterTitle();
05786   
05787   TProfile2D* pStsYvsXFU2=new TProfile2D("pStsYvsXFU2","pStsYvsXFU2",
05788                                          nYvsX60,-4,4,nYvsX60,-4,4);
05789   pStsYvsXFU2->SetTitle("MEU2");
05790   pStsYvsXFU2->GetXaxis()->SetTitle("X (m)");
05791   pStsYvsXFU2->GetXaxis()->CenterTitle();
05792   pStsYvsXFU2->GetYaxis()->SetTitle("Y (m)");
05793   pStsYvsXFU2->GetYaxis()->CenterTitle();
05794 
05795   TProfile2D* pStsYvsXFU1Trk=new TProfile2D("pStsYvsXFU1Trk",
05796                                             "pStsYvsXFU1Trk",
05797                                             nYvsX60,-4,4,nYvsX60,-4,4);
05798   pStsYvsXFU1Trk->SetTitle("MEU");
05799   pStsYvsXFU1Trk->GetXaxis()->SetTitle("X (m)");
05800   pStsYvsXFU1Trk->GetXaxis()->CenterTitle();
05801   pStsYvsXFU1Trk->GetYaxis()->SetTitle("Y (m)");
05802   pStsYvsXFU1Trk->GetYaxis()->CenterTitle();
05803 
05804   TProfile2D* pStsYvsXFU2Trk=new TProfile2D("pStsYvsXFU2Trk",
05805                                             "pStsYvsXFU2Trk",
05806                                             nYvsX60,-4,4,nYvsX60,-4,4);
05807   pStsYvsXFU2Trk->SetTitle("MEU");
05808   pStsYvsXFU2Trk->GetXaxis()->SetTitle("X (m)");
05809   pStsYvsXFU2Trk->GetXaxis()->CenterTitle();
05810   pStsYvsXFU2Trk->GetYaxis()->SetTitle("Y (m)");
05811   pStsYvsXFU2Trk->GetYaxis()->CenterTitle();
05812 
05813   TProfile2D* pStsYvsXFV=new TProfile2D("pStsYvsXFV","pStsYvsXFV",
05814                                         nYvsX60,-4,4,nYvsX60,-4,4);
05815   pStsYvsXFV->SetTitle("MEU");
05816   pStsYvsXFV->GetXaxis()->SetTitle("X (m)");
05817   pStsYvsXFV->GetXaxis()->CenterTitle();
05818   pStsYvsXFV->GetYaxis()->SetTitle("Y (m)");
05819   pStsYvsXFV->GetYaxis()->CenterTitle();
05820 
05821   TProfile2D* pStsYvsXFV1=new TProfile2D("pStsYvsXFV1","pStsYvsXFV1",
05822                                          nYvsX60,-4,4,nYvsX60,-4,4);
05823   pStsYvsXFV1->SetTitle("MEU");
05824   pStsYvsXFV1->GetXaxis()->SetTitle("X (m)");
05825   pStsYvsXFV1->GetXaxis()->CenterTitle();
05826   pStsYvsXFV1->GetYaxis()->SetTitle("Y (m)");
05827   pStsYvsXFV1->GetYaxis()->CenterTitle();
05828 
05829   TProfile2D* pStsYvsXFV2=new TProfile2D("pStsYvsXFV2","pStsYvsXFV2",
05830                                          nYvsX60,-4,4,nYvsX60,-4,4);
05831   pStsYvsXFV2->SetTitle("MEU");
05832   pStsYvsXFV2->GetXaxis()->SetTitle("X (m)");
05833   pStsYvsXFV2->GetXaxis()->CenterTitle();
05834   pStsYvsXFV2->GetYaxis()->SetTitle("Y (m)");
05835   pStsYvsXFV2->GetYaxis()->CenterTitle();
05836 
05837   TProfile2D* pStsYvsXFV1Trk=new TProfile2D("pStsYvsXFV1Trk",
05838                                             "pStsYvsXFV1Trk",
05839                                             nYvsX60,-4,4,nYvsX60,-4,4);
05840   pStsYvsXFV1Trk->SetTitle("MEU");
05841   pStsYvsXFV1Trk->GetXaxis()->SetTitle("X (m)");
05842   pStsYvsXFV1Trk->GetXaxis()->CenterTitle();
05843   pStsYvsXFV1Trk->GetYaxis()->SetTitle("Y (m)");
05844   pStsYvsXFV1Trk->GetYaxis()->CenterTitle();
05845 
05846   TProfile2D* pStsYvsXFV2Trk=new TProfile2D("pStsYvsXFV2Trk",
05847                                             "pStsYvsXFV2Trk",
05848                                             nYvsX60,-4,4,nYvsX60,-4,4);
05849   pStsYvsXFV2Trk->SetTitle("MEU");
05850   pStsYvsXFV2Trk->GetXaxis()->SetTitle("X (m)");
05851   pStsYvsXFV2Trk->GetXaxis()->CenterTitle();
05852   pStsYvsXFV2Trk->GetYaxis()->SetTitle("Y (m)");
05853   pStsYvsXFV2Trk->GetYaxis()->CenterTitle();
05854 
05855   TProfile2D* pAdcYvsXFU=new TProfile2D("pAdcYvsXFU","pAdcYvsXFU",
05856                                         nYvsX60,-4,4,nYvsX60,-4,4);
05857   pAdcYvsXFU->SetTitle("MEU");
05858   pAdcYvsXFU->GetXaxis()->SetTitle("X (m)");
05859   pAdcYvsXFU->GetXaxis()->CenterTitle();
05860   pAdcYvsXFU->GetYaxis()->SetTitle("Y (m)");
05861   pAdcYvsXFU->GetYaxis()->CenterTitle();
05862 
05863   TProfile2D* pAdcYvsXFU1=new TProfile2D("pAdcYvsXFU1","pAdcYvsXFU1",
05864                                          nYvsX60,-4,4,nYvsX60,-4,4);
05865   pAdcYvsXFU1->SetTitle("MEU1");
05866   pAdcYvsXFU1->GetXaxis()->SetTitle("X (m)");
05867   pAdcYvsXFU1->GetXaxis()->CenterTitle();
05868   pAdcYvsXFU1->GetYaxis()->SetTitle("Y (m)");
05869   pAdcYvsXFU1->GetYaxis()->CenterTitle();
05870 
05871   TProfile2D* pAdcYvsXFU2=new TProfile2D("pAdcYvsXFU2","pAdcYvsXFU2",
05872                                          nYvsX60,-4,4,nYvsX60,-4,4);
05873   pAdcYvsXFU2->SetTitle("MEU2");
05874   pAdcYvsXFU2->GetXaxis()->SetTitle("X (m)");
05875   pAdcYvsXFU2->GetXaxis()->CenterTitle();
05876   pAdcYvsXFU2->GetYaxis()->SetTitle("Y (m)");
05877   pAdcYvsXFU2->GetYaxis()->CenterTitle();
05878   
05879   TProfile2D* pAdcYvsXFV=new TProfile2D("pAdcYvsXFV","pAdcYvsXFV",
05880                                         nYvsX60,-4,4,nYvsX60,-4,4);
05881   pAdcYvsXFV->SetTitle("MEU");
05882   pAdcYvsXFV->GetXaxis()->SetTitle("X (m)");
05883   pAdcYvsXFV->GetXaxis()->CenterTitle();
05884   pAdcYvsXFV->GetYaxis()->SetTitle("Y (m)");
05885   pAdcYvsXFV->GetYaxis()->CenterTitle();
05886 
05887   TProfile2D* pAdcYvsXFV1=new TProfile2D("pAdcYvsXFV1","pAdcYvsXFV1",
05888                                          nYvsX60,-4,4,nYvsX60,-4,4);
05889   pAdcYvsXFV1->SetTitle("MEU");
05890   pAdcYvsXFV1->GetXaxis()->SetTitle("X (m)");
05891   pAdcYvsXFV1->GetXaxis()->CenterTitle();
05892   pAdcYvsXFV1->GetYaxis()->SetTitle("Y (m)");
05893   pAdcYvsXFV1->GetYaxis()->CenterTitle();
05894 
05895   TProfile2D* pAdcYvsXFV2=new TProfile2D("pAdcYvsXFV2","pAdcYvsXFV2",
05896                                          nYvsX60,-4,4,nYvsX60,-4,4);
05897   pAdcYvsXFV2->SetTitle("MEU");
05898   pAdcYvsXFV2->GetXaxis()->SetTitle("X (m)");
05899   pAdcYvsXFV2->GetXaxis()->CenterTitle();
05900   pAdcYvsXFV2->GetYaxis()->SetTitle("Y (m)");
05901   pAdcYvsXFV2->GetYaxis()->CenterTitle();
05902 
05903 
05904   //PARTIAL planes
05906   TH2F* hYvsXP=new TH2F("hYvsXP","hYvsXP",nYvsX60,-4,4,nYvsX60,-4,4);
05907   hYvsXP->SetTitle("MEU");
05908   hYvsXP->GetXaxis()->SetTitle("X (m)");
05909   hYvsXP->GetXaxis()->CenterTitle();
05910   hYvsXP->GetYaxis()->SetTitle("Y (m)");
05911   hYvsXP->GetYaxis()->CenterTitle();
05912 
05913   TH2F* hYvsXPVtx=new TH2F
05914     ("hYvsXPVtx","hYvsXPVtx",nYvsX60,-4,4,nYvsX60,-4,4);
05915   hYvsXPVtx->SetTitle("MEU");
05916   hYvsXPVtx->GetXaxis()->SetTitle("X (m)");
05917   hYvsXPVtx->GetXaxis()->CenterTitle();
05918   hYvsXPVtx->GetYaxis()->SetTitle("Y (m)");
05919   hYvsXPVtx->GetYaxis()->CenterTitle();
05920 
05921   TH2F* hYvsXPEnd=new TH2F
05922     ("hYvsXPEnd","hYvsXPEnd",nYvsX60,-4,4,nYvsX60,-4,4);
05923   hYvsXPEnd->SetTitle("MEU");
05924   hYvsXPEnd->GetXaxis()->SetTitle("X (m)");
05925   hYvsXPEnd->GetXaxis()->CenterTitle();
05926   hYvsXPEnd->GetYaxis()->SetTitle("Y (m)");
05927   hYvsXPEnd->GetYaxis()->CenterTitle();
05928 
05929   TProfile2D* pYvsXP=new TProfile2D
05930     ("pYvsXP","pYvsXP",nYvsX60,-4,4,nYvsX60,-4,4);
05931   pYvsXP->SetTitle("MEU");
05932   pYvsXP->GetXaxis()->SetTitle("X (m)");
05933   pYvsXP->GetXaxis()->CenterTitle();
05934   pYvsXP->GetYaxis()->SetTitle("Y (m)");
05935   pYvsXP->GetYaxis()->CenterTitle();
05936 
05937   TH2F* hYvsXPU=new TH2F
05938     ("hYvsXPU","hYvsXPU",nYvsX60,-4,4,nYvsX60,-4,4);
05939   hYvsXPU->SetTitle("MEU");
05940   hYvsXPU->GetXaxis()->SetTitle("X (m)");
05941   hYvsXPU->GetXaxis()->CenterTitle();
05942   hYvsXPU->GetYaxis()->SetTitle("Y (m)");
05943   hYvsXPU->GetYaxis()->CenterTitle();
05944 
05945   TProfile2D* pYvsXPU=new TProfile2D
05946     ("pYvsXPU","pYvsXPU",nYvsX60,-4,4,nYvsX60,-4,4);
05947   pYvsXPU->SetTitle("MEU");
05948   pYvsXPU->GetXaxis()->SetTitle("X (m)");
05949   pYvsXPU->GetXaxis()->CenterTitle();
05950   pYvsXPU->GetYaxis()->SetTitle("Y (m)");
05951   pYvsXPU->GetYaxis()->CenterTitle();
05952 
05953   TProfile2D* pYvsXPU1=new TProfile2D
05954     ("pYvsXPU1","pYvsXPU1",nYvsX60,-4,4,nYvsX60,-4,4);
05955   pYvsXPU1->SetTitle("MEU1");
05956   pYvsXPU1->GetXaxis()->SetTitle("X (m)");
05957   pYvsXPU1->GetXaxis()->CenterTitle();
05958   pYvsXPU1->GetYaxis()->SetTitle("Y (m)");
05959   pYvsXPU1->GetYaxis()->CenterTitle();
05960 
05961   TProfile2D* pYvsXPU2=new TProfile2D
05962     ("pYvsXPU2","pYvsXPU2",nYvsX60,-4,4,nYvsX60,-4,4);
05963   pYvsXPU2->SetTitle("MEU2");
05964   pYvsXPU2->GetXaxis()->SetTitle("X (m)");
05965   pYvsXPU2->GetXaxis()->CenterTitle();
05966   pYvsXPU2->GetYaxis()->SetTitle("Y (m)");
05967   pYvsXPU2->GetYaxis()->CenterTitle();
05968 
05969   TH2F* hYvsXPV=new TH2F
05970     ("hYvsXPV","hYvsXPV",nYvsX60,-4,4,nYvsX60,-4,4);
05971   hYvsXPV->SetTitle("MEU");
05972   hYvsXPV->GetXaxis()->SetTitle("X (m)");
05973   hYvsXPV->GetXaxis()->CenterTitle();
05974   hYvsXPV->GetYaxis()->SetTitle("Y (m)");
05975   hYvsXPV->GetYaxis()->CenterTitle();
05976 
05977   TProfile2D* pYvsXPV=new TProfile2D("pYvsXPV","pYvsXPV",
05978                                      nYvsX60,-4,4,nYvsX60,-4,4);
05979   pYvsXPV->SetTitle("MEU");
05980   pYvsXPV->GetXaxis()->SetTitle("X (m)");
05981   pYvsXPV->GetXaxis()->CenterTitle();
05982   pYvsXPV->GetYaxis()->SetTitle("Y (m)");
05983   pYvsXPV->GetYaxis()->CenterTitle();
05984 
05985   TProfile2D* pYvsXPV1=new TProfile2D("pYvsXPV1","pYvsXPV1",
05986                                       nYvsX60,-4,4,nYvsX60,-4,4);
05987   pYvsXPV1->SetTitle("MEU");
05988   pYvsXPV1->GetXaxis()->SetTitle("X (m)");
05989   pYvsXPV1->GetXaxis()->CenterTitle();
05990   pYvsXPV1->GetYaxis()->SetTitle("Y (m)");
05991   pYvsXPV1->GetYaxis()->CenterTitle();
05992 
05993   TProfile2D* pYvsXPV2=new TProfile2D("pYvsXPV2","pYvsXPV2",
05994                                       nYvsX60,-4,4,nYvsX60,-4,4);
05995   pYvsXPV2->SetTitle("MEU");
05996   pYvsXPV2->GetXaxis()->SetTitle("X (m)");
05997   pYvsXPV2->GetXaxis()->CenterTitle();
05998   pYvsXPV2->GetYaxis()->SetTitle("Y (m)");
05999   pYvsXPV2->GetYaxis()->CenterTitle();
06000 
06001   TProfile2D* pStsYvsXPU=new TProfile2D("pStsYvsXPU","pStsYvsXPU",
06002                                         nYvsX60,-4,4,nYvsX60,-4,4);
06003   pStsYvsXPU->SetTitle("MEU");
06004   pStsYvsXPU->GetXaxis()->SetTitle("X (m)");
06005   pStsYvsXPU->GetXaxis()->CenterTitle();
06006   pStsYvsXPU->GetYaxis()->SetTitle("Y (m)");
06007   pStsYvsXPU->GetYaxis()->CenterTitle();
06008   
06009   TProfile2D* pStsYvsXPU1=new TProfile2D("pStsYvsXPU1","pStsYvsXPU1",
06010                                          nYvsX60,-4,4,nYvsX60,-4,4);
06011   pStsYvsXPU1->SetTitle("MEU1");
06012   pStsYvsXPU1->GetXaxis()->SetTitle("X (m)");
06013   pStsYvsXPU1->GetXaxis()->CenterTitle();
06014   pStsYvsXPU1->GetYaxis()->SetTitle("Y (m)");
06015   pStsYvsXPU1->GetYaxis()->CenterTitle();
06016   
06017   TProfile2D* pStsYvsXPU2=new TProfile2D("pStsYvsXPU2","pStsYvsXPU2",
06018                                          nYvsX60,-4,4,nYvsX60,-4,4);
06019   pStsYvsXPU2->SetTitle("MEU2");
06020   pStsYvsXPU2->GetXaxis()->SetTitle("X (m)");
06021   pStsYvsXPU2->GetXaxis()->CenterTitle();
06022   pStsYvsXPU2->GetYaxis()->SetTitle("Y (m)");
06023   pStsYvsXPU2->GetYaxis()->CenterTitle();
06024 
06025   TProfile2D* pStsYvsXPU1Trk=new TProfile2D("pStsYvsXPU1Trk",
06026                                             "pStsYvsXPU1Trk",
06027                                             nYvsX60,-4,4,nYvsX60,-4,4);
06028   pStsYvsXPU1Trk->SetTitle("MEU");
06029   pStsYvsXPU1Trk->GetXaxis()->SetTitle("X (m)");
06030   pStsYvsXPU1Trk->GetXaxis()->CenterTitle();
06031   pStsYvsXPU1Trk->GetYaxis()->SetTitle("Y (m)");
06032   pStsYvsXPU1Trk->GetYaxis()->CenterTitle();
06033 
06034   TProfile2D* pStsYvsXPU2Trk=new TProfile2D("pStsYvsXPU2Trk",
06035                                             "pStsYvsXPU2Trk",
06036                                             nYvsX60,-4,4,nYvsX60,-4,4);
06037   pStsYvsXPU2Trk->SetTitle("MEU");
06038   pStsYvsXPU2Trk->GetXaxis()->SetTitle("X (m)");
06039   pStsYvsXPU2Trk->GetXaxis()->CenterTitle();
06040   pStsYvsXPU2Trk->GetYaxis()->SetTitle("Y (m)");
06041   pStsYvsXPU2Trk->GetYaxis()->CenterTitle();
06042 
06043   TProfile2D* pStsYvsXPV=new TProfile2D("pStsYvsXPV","pStsYvsXPV",
06044                                         nYvsX60,-4,4,nYvsX60,-4,4);
06045   pStsYvsXPV->SetTitle("MEU");
06046   pStsYvsXPV->GetXaxis()->SetTitle("X (m)");
06047   pStsYvsXPV->GetXaxis()->CenterTitle();
06048   pStsYvsXPV->GetYaxis()->SetTitle("Y (m)");
06049   pStsYvsXPV->GetYaxis()->CenterTitle();
06050 
06051   TProfile2D* pStsYvsXPV1=new TProfile2D("pStsYvsXPV1","pStsYvsXPV1",
06052                                          nYvsX60,-4,4,nYvsX60,-4,4);
06053   pStsYvsXPV1->SetTitle("MEU");
06054   pStsYvsXPV1->GetXaxis()->SetTitle("X (m)");
06055   pStsYvsXPV1->GetXaxis()->CenterTitle();
06056   pStsYvsXPV1->GetYaxis()->SetTitle("Y (m)");
06057   pStsYvsXPV1->GetYaxis()->CenterTitle();
06058 
06059   TProfile2D* pStsYvsXPV2=new TProfile2D("pStsYvsXPV2","pStsYvsXPV2",
06060                                          nYvsX60,-4,4,nYvsX60,-4,4);
06061   pStsYvsXPV2->SetTitle("MEU");
06062   pStsYvsXPV2->GetXaxis()->SetTitle("X (m)");
06063   pStsYvsXPV2->GetXaxis()->CenterTitle();
06064   pStsYvsXPV2->GetYaxis()->SetTitle("Y (m)");
06065   pStsYvsXPV2->GetYaxis()->CenterTitle();
06066 
06067   TProfile2D* pStsYvsXPV1Trk=new TProfile2D("pStsYvsXPV1Trk",
06068                                             "pStsYvsXPV1Trk",
06069                                             nYvsX60,-4,4,nYvsX60,-4,4);
06070   pStsYvsXPV1Trk->SetTitle("MEU");
06071   pStsYvsXPV1Trk->GetXaxis()->SetTitle("X (m)");
06072   pStsYvsXPV1Trk->GetXaxis()->CenterTitle();
06073   pStsYvsXPV1Trk->GetYaxis()->SetTitle("Y (m)");
06074   pStsYvsXPV1Trk->GetYaxis()->CenterTitle();
06075 
06076   TProfile2D* pStsYvsXPV2Trk=new TProfile2D("pStsYvsXPV2Trk",
06077                                             "pStsYvsXPV2Trk",
06078                                             nYvsX60,-4,4,nYvsX60,-4,4);
06079   pStsYvsXPV2Trk->SetTitle("MEU");
06080   pStsYvsXPV2Trk->GetXaxis()->SetTitle("X (m)");
06081   pStsYvsXPV2Trk->GetXaxis()->CenterTitle();
06082   pStsYvsXPV2Trk->GetYaxis()->SetTitle("Y (m)");
06083   pStsYvsXPV2Trk->GetYaxis()->CenterTitle();
06084 
06085   TProfile2D* pAdcYvsXPU=new TProfile2D("pAdcYvsXPU","pAdcYvsXPU",
06086                                         nYvsX60,-4,4,nYvsX60,-4,4);
06087   pAdcYvsXPU->SetTitle("MEU");
06088   pAdcYvsXPU->GetXaxis()->SetTitle("X (m)");
06089   pAdcYvsXPU->GetXaxis()->CenterTitle();
06090   pAdcYvsXPU->GetYaxis()->SetTitle("Y (m)");
06091   pAdcYvsXPU->GetYaxis()->CenterTitle();
06092 
06093   TProfile2D* pAdcYvsXPU1=new TProfile2D("pAdcYvsXPU1","pAdcYvsXPU1",
06094                                          nYvsX60,-4,4,nYvsX60,-4,4);
06095   pAdcYvsXPU1->SetTitle("MEU1");
06096   pAdcYvsXPU1->GetXaxis()->SetTitle("X (m)");
06097   pAdcYvsXPU1->GetXaxis()->CenterTitle();
06098   pAdcYvsXPU1->GetYaxis()->SetTitle("Y (m)");
06099   pAdcYvsXPU1->GetYaxis()->CenterTitle();
06100 
06101   TProfile2D* pAdcYvsXPU2=new TProfile2D("pAdcYvsXPU2","pAdcYvsXPU2",
06102                                          nYvsX60,-4,4,nYvsX60,-4,4);
06103   pAdcYvsXPU2->SetTitle("MEU2");
06104   pAdcYvsXPU2->GetXaxis()->SetTitle("X (m)");
06105   pAdcYvsXPU2->GetXaxis()->CenterTitle();
06106   pAdcYvsXPU2->GetYaxis()->SetTitle("Y (m)");
06107   pAdcYvsXPU2->GetYaxis()->CenterTitle();
06108   
06109   TProfile2D* pAdcYvsXPV=new TProfile2D("pAdcYvsXPV","pAdcYvsXPV",
06110                                         nYvsX60,-4,4,nYvsX60,-4,4);
06111   pAdcYvsXPV->SetTitle("MEU");
06112   pAdcYvsXPV->GetXaxis()->SetTitle("X (m)");
06113   pAdcYvsXPV->GetXaxis()->CenterTitle();
06114   pAdcYvsXPV->GetYaxis()->SetTitle("Y (m)");
06115   pAdcYvsXPV->GetYaxis()->CenterTitle();
06116 
06117   TProfile2D* pAdcYvsXPV1=new TProfile2D("pAdcYvsXPV1","pAdcYvsXPV1",
06118                                          nYvsX60,-4,4,nYvsX60,-4,4);
06119   pAdcYvsXPV1->SetTitle("MEU");
06120   pAdcYvsXPV1->GetXaxis()->SetTitle("X (m)");
06121   pAdcYvsXPV1->GetXaxis()->CenterTitle();
06122   pAdcYvsXPV1->GetYaxis()->SetTitle("Y (m)");
06123   pAdcYvsXPV1->GetYaxis()->CenterTitle();
06124 
06125   TProfile2D* pAdcYvsXPV2=new TProfile2D("pAdcYvsXPV2","pAdcYvsXPV2",
06126                                          nYvsX60,-4,4,nYvsX60,-4,4);
06127   pAdcYvsXPV2->SetTitle("MEU");
06128   pAdcYvsXPV2->GetXaxis()->SetTitle("X (m)");
06129   pAdcYvsXPV2->GetXaxis()->CenterTitle();
06130   pAdcYvsXPV2->GetYaxis()->SetTitle("Y (m)");
06131   pAdcYvsXPV2->GetYaxis()->CenterTitle();
06133 
06134 
06135 
06136 
06138   Int_t nYvsX100=100;
06139   TH2F* hYvsX100=new TH2F
06140     ("hYvsX100","hYvsX100",nYvsX100,-4,4,nYvsX100,-4,4);
06141   hYvsX100->SetTitle("MEU");
06142   hYvsX100->GetXaxis()->SetTitle("X (m)");
06143   hYvsX100->GetXaxis()->CenterTitle();
06144   hYvsX100->GetYaxis()->SetTitle("Y (m)");
06145   hYvsX100->GetYaxis()->CenterTitle();
06146 
06147   TH2F* hYvsX100Vtx=new TH2F
06148     ("hYvsX100Vtx","hYvsX100Vtx",nYvsX100,-4,4,nYvsX100,-4,4);
06149   hYvsX100Vtx->SetTitle("MEU");
06150   hYvsX100Vtx->GetXaxis()->SetTitle("X (m)");
06151   hYvsX100Vtx->GetXaxis()->CenterTitle();
06152   hYvsX100Vtx->GetYaxis()->SetTitle("Y (m)");
06153   hYvsX100Vtx->GetYaxis()->CenterTitle();
06154 
06155   TH2F* hYvsX100End=new TH2F
06156     ("hYvsX100End","hYvsX100End",nYvsX100,-4,4,nYvsX100,-4,4);
06157   hYvsX100End->SetTitle("MEU");
06158   hYvsX100End->GetXaxis()->SetTitle("X (m)");
06159   hYvsX100End->GetXaxis()->CenterTitle();
06160   hYvsX100End->GetYaxis()->SetTitle("Y (m)");
06161   hYvsX100End->GetYaxis()->CenterTitle();
06162 
06163   TProfile2D* pYvsX100=new TProfile2D
06164     ("pYvsX100","pYvsX100",nYvsX100,-4,4,nYvsX100,-4,4);
06165   pYvsX100->SetTitle("MEU");
06166   pYvsX100->GetXaxis()->SetTitle("X (m)");
06167   pYvsX100->GetXaxis()->CenterTitle();
06168   pYvsX100->GetYaxis()->SetTitle("Y (m)");
06169   pYvsX100->GetYaxis()->CenterTitle();
06170 
06171   TProfile2D* pYvsXPitt100=new TProfile2D
06172     ("pYvsXPitt100","pYvsXPitt100",nYvsX100,-4,4,nYvsX100,-4,4);
06173   pYvsXPitt100->SetTitle("MEU");
06174   pYvsXPitt100->GetXaxis()->SetTitle("X (m)");
06175   pYvsXPitt100->GetXaxis()->CenterTitle();
06176   pYvsXPitt100->GetYaxis()->SetTitle("Y (m)");
06177   pYvsXPitt100->GetYaxis()->CenterTitle();
06178 
06179   TProfile2D* pYvsXPittZ100=new TProfile2D
06180     ("pYvsXPittZ100","pYvsXPittZ100",nYvsX100,-4,4,nYvsX100,-4,4);
06181   pYvsXPittZ100->SetTitle("MEU");
06182   pYvsXPittZ100->GetXaxis()->SetTitle("X (m)");
06183   pYvsXPittZ100->GetXaxis()->CenterTitle();
06184   pYvsXPittZ100->GetYaxis()->SetTitle("Y (m)");
06185   pYvsXPittZ100->GetYaxis()->CenterTitle();
06186 
06187   TH2F* hYvsX100U=new TH2F("hYvsX100U","hYvsX100U",nYvsX100,-4,4,nYvsX100,-4,4);
06188   hYvsX100U->SetTitle("MEU");
06189   hYvsX100U->GetXaxis()->SetTitle("X (m)");
06190   hYvsX100U->GetXaxis()->CenterTitle();
06191   hYvsX100U->GetYaxis()->SetTitle("Y (m)");
06192   hYvsX100U->GetYaxis()->CenterTitle();
06193 
06194   TProfile2D* pYvsX100U=new TProfile2D("pYvsX100U","pYvsX100U",
06195                                        nYvsX100,-4,4,nYvsX100,-4,4);
06196   pYvsX100U->SetTitle("MEU");
06197   pYvsX100U->GetXaxis()->SetTitle("X (m)");
06198   pYvsX100U->GetXaxis()->CenterTitle();
06199   pYvsX100U->GetYaxis()->SetTitle("Y (m)");
06200   pYvsX100U->GetYaxis()->CenterTitle();
06201 
06202   TProfile2D* pYvsX100U1=new TProfile2D("pYvsX100U1","pYvsX100U1",
06203                                         nYvsX100,-4,4,nYvsX100,-4,4);
06204   pYvsX100U1->SetTitle("MEU1");
06205   pYvsX100U1->GetXaxis()->SetTitle("X (m)");
06206   pYvsX100U1->GetXaxis()->CenterTitle();
06207   pYvsX100U1->GetYaxis()->SetTitle("Y (m)");
06208   pYvsX100U1->GetYaxis()->CenterTitle();
06209 
06210   TProfile2D* pYvsX100U2=new TProfile2D("pYvsX100U2","pYvsX100U2",
06211                                         nYvsX100,-4,4,nYvsX100,-4,4);
06212   pYvsX100U2->SetTitle("MEU2");
06213   pYvsX100U2->GetXaxis()->SetTitle("X (m)");
06214   pYvsX100U2->GetXaxis()->CenterTitle();
06215   pYvsX100U2->GetYaxis()->SetTitle("Y (m)");
06216   pYvsX100U2->GetYaxis()->CenterTitle();
06217 
06218   TH2F* hYvsX100V=new TH2F("hYvsX100V","hYvsX100V",nYvsX100,-4,4,nYvsX100,-4,4);
06219   hYvsX100V->SetTitle("MEU");
06220   hYvsX100V->GetXaxis()->SetTitle("X (m)");
06221   hYvsX100V->GetXaxis()->CenterTitle();
06222   hYvsX100V->GetYaxis()->SetTitle("Y (m)");
06223   hYvsX100V->GetYaxis()->CenterTitle();
06224 
06225   TProfile2D* pYvsX100V=new TProfile2D("pYvsX100V","pYvsX100V",
06226                                        nYvsX100,-4,4,nYvsX100,-4,4);
06227   pYvsX100V->SetTitle("MEU");
06228   pYvsX100V->GetXaxis()->SetTitle("X (m)");
06229   pYvsX100V->GetXaxis()->CenterTitle();
06230   pYvsX100V->GetYaxis()->SetTitle("Y (m)");
06231   pYvsX100V->GetYaxis()->CenterTitle();
06232 
06233   TProfile2D* pYvsX100V1=new TProfile2D("pYvsX100V1","pYvsX100V1",
06234                                         nYvsX100,-4,4,nYvsX100,-4,4);
06235   pYvsX100V1->SetTitle("MEU");
06236   pYvsX100V1->GetXaxis()->SetTitle("X (m)");
06237   pYvsX100V1->GetXaxis()->CenterTitle();
06238   pYvsX100V1->GetYaxis()->SetTitle("Y (m)");
06239   pYvsX100V1->GetYaxis()->CenterTitle();
06240 
06241   TProfile2D* pYvsX100V2=new TProfile2D("pYvsX100V2","pYvsX100V2",
06242                                         nYvsX100,-4,4,nYvsX100,-4,4);
06243   pYvsX100V2->SetTitle("MEU");
06244   pYvsX100V2->GetXaxis()->SetTitle("X (m)");
06245   pYvsX100V2->GetXaxis()->CenterTitle();
06246   pYvsX100V2->GetYaxis()->SetTitle("Y (m)");
06247   pYvsX100V2->GetYaxis()->CenterTitle();
06248 
06249   TProfile2D* pStsYvsX100U=new TProfile2D("pStsYvsX100U","pStsYvsX100U",
06250                                           nYvsX100,-4,4,nYvsX100,-4,4);
06251   pStsYvsX100U->SetTitle("MEU");
06252   pStsYvsX100U->GetXaxis()->SetTitle("X (m)");
06253   pStsYvsX100U->GetXaxis()->CenterTitle();
06254   pStsYvsX100U->GetYaxis()->SetTitle("Y (m)");
06255   pStsYvsX100U->GetYaxis()->CenterTitle();
06256   
06257   TProfile2D* pStsYvsX100U1=new TProfile2D("pStsYvsX100U1","pStsYvsX100U1",
06258                                            nYvsX100,-4,4,nYvsX100,-4,4);
06259   pStsYvsX100U1->SetTitle("MEU1");
06260   pStsYvsX100U1->GetXaxis()->SetTitle("X (m)");
06261   pStsYvsX100U1->GetXaxis()->CenterTitle();
06262   pStsYvsX100U1->GetYaxis()->SetTitle("Y (m)");
06263   pStsYvsX100U1->GetYaxis()->CenterTitle();
06264   
06265   TProfile2D* pStsYvsX100U2=new TProfile2D("pStsYvsX100U2","pStsYvsX100U2",
06266                                            nYvsX100,-4,4,nYvsX100,-4,4);
06267   pStsYvsX100U2->SetTitle("MEU2");
06268   pStsYvsX100U2->GetXaxis()->SetTitle("X (m)");
06269   pStsYvsX100U2->GetXaxis()->CenterTitle();
06270   pStsYvsX100U2->GetYaxis()->SetTitle("Y (m)");
06271   pStsYvsX100U2->GetYaxis()->CenterTitle();
06272 
06273   TProfile2D* pStsYvsX100U1Trk=new TProfile2D("pStsYvsX100U1Trk",
06274                                               "pStsYvsX100U1Trk",
06275                                               nYvsX100,-4,4,nYvsX100,-4,4);
06276   pStsYvsX100U1Trk->SetTitle("MEU");
06277   pStsYvsX100U1Trk->GetXaxis()->SetTitle("X (m)");
06278   pStsYvsX100U1Trk->GetXaxis()->CenterTitle();
06279   pStsYvsX100U1Trk->GetYaxis()->SetTitle("Y (m)");
06280   pStsYvsX100U1Trk->GetYaxis()->CenterTitle();
06281 
06282   TProfile2D* pStsYvsX100U2Trk=new TProfile2D("pStsYvsX100U2Trk",
06283                                               "pStsYvsX100U2Trk",
06284                                               nYvsX100,-4,4,nYvsX100,-4,4);
06285   pStsYvsX100U2Trk->SetTitle("MEU");
06286   pStsYvsX100U2Trk->GetXaxis()->SetTitle("X (m)");
06287   pStsYvsX100U2Trk->GetXaxis()->CenterTitle();
06288   pStsYvsX100U2Trk->GetYaxis()->SetTitle("Y (m)");
06289   pStsYvsX100U2Trk->GetYaxis()->CenterTitle();
06290 
06291   TProfile2D* pStsYvsX100V=new TProfile2D("pStsYvsX100V","pStsYvsX100V",
06292                                           nYvsX100,-4,4,nYvsX100,-4,4);
06293   pStsYvsX100V->SetTitle("MEU");
06294   pStsYvsX100V->GetXaxis()->SetTitle("X (m)");
06295   pStsYvsX100V->GetXaxis()->CenterTitle();
06296   pStsYvsX100V->GetYaxis()->SetTitle("Y (m)");
06297   pStsYvsX100V->GetYaxis()->CenterTitle();
06298 
06299   TProfile2D* pStsYvsX100V1=new TProfile2D("pStsYvsX100V1","pStsYvsX100V1",
06300                                            nYvsX100,-4,4,nYvsX100,-4,4);
06301   pStsYvsX100V1->SetTitle("MEU");
06302   pStsYvsX100V1->GetXaxis()->SetTitle("X (m)");
06303   pStsYvsX100V1->GetXaxis()->CenterTitle();
06304   pStsYvsX100V1->GetYaxis()->SetTitle("Y (m)");
06305   pStsYvsX100V1->GetYaxis()->CenterTitle();
06306 
06307   TProfile2D* pStsYvsX100V2=new TProfile2D("pStsYvsX100V2","pStsYvsX100V2",
06308                                            nYvsX100,-4,4,nYvsX100,-4,4);
06309   pStsYvsX100V2->SetTitle("MEU");
06310   pStsYvsX100V2->GetXaxis()->SetTitle("X (m)");
06311   pStsYvsX100V2->GetXaxis()->CenterTitle();
06312   pStsYvsX100V2->GetYaxis()->SetTitle("Y (m)");
06313   pStsYvsX100V2->GetYaxis()->CenterTitle();
06314 
06315   TProfile2D* pStsYvsX100V1Trk=new TProfile2D("pStsYvsX100V1Trk",
06316                                               "pStsYvsX100V1Trk",
06317                                               nYvsX100,-4,4,nYvsX100,-4,4);
06318   pStsYvsX100V1Trk->SetTitle("MEU");
06319   pStsYvsX100V1Trk->GetXaxis()->SetTitle("X (m)");
06320   pStsYvsX100V1Trk->GetXaxis()->CenterTitle();
06321   pStsYvsX100V1Trk->GetYaxis()->SetTitle("Y (m)");
06322   pStsYvsX100V1Trk->GetYaxis()->CenterTitle();
06323 
06324   TProfile2D* pStsYvsX100V2Trk=new TProfile2D("pStsYvsX100V2Trk",
06325                                               "pStsYvsX100V2Trk",
06326                                               nYvsX100,-4,4,nYvsX100,-4,4);
06327   pStsYvsX100V2Trk->SetTitle("MEU");
06328   pStsYvsX100V2Trk->GetXaxis()->SetTitle("X (m)");
06329   pStsYvsX100V2Trk->GetXaxis()->CenterTitle();
06330   pStsYvsX100V2Trk->GetYaxis()->SetTitle("Y (m)");
06331   pStsYvsX100V2Trk->GetYaxis()->CenterTitle();
06332 
06333   TProfile2D* pAdcYvsX100U=new TProfile2D("pAdcYvsX100U","pAdcYvsX100U",
06334                                           nYvsX100,-4,4,nYvsX100,-4,4);
06335   pAdcYvsX100U->SetTitle("MEU");
06336   pAdcYvsX100U->GetXaxis()->SetTitle("X (m)");
06337   pAdcYvsX100U->GetXaxis()->CenterTitle();
06338   pAdcYvsX100U->GetYaxis()->SetTitle("Y (m)");
06339   pAdcYvsX100U->GetYaxis()->CenterTitle();
06340 
06341   TProfile2D* pAdcYvsX100U1=new TProfile2D("pAdcYvsX100U1","pAdcYvsX100U1",
06342                                            nYvsX100,-4,4,nYvsX100,-4,4);
06343   pAdcYvsX100U1->SetTitle("MEU1");
06344   pAdcYvsX100U1->GetXaxis()->SetTitle("X (m)");
06345   pAdcYvsX100U1->GetXaxis()->CenterTitle();
06346   pAdcYvsX100U1->GetYaxis()->SetTitle("Y (m)");
06347   pAdcYvsX100U1->GetYaxis()->CenterTitle();
06348 
06349   TProfile2D* pAdcYvsX100U2=new TProfile2D("pAdcYvsX100U2","pAdcYvsX100U2",
06350                                            nYvsX100,-4,4,nYvsX100,-4,4);
06351   pAdcYvsX100U2->SetTitle("MEU2");
06352   pAdcYvsX100U2->GetXaxis()->SetTitle("X (m)");
06353   pAdcYvsX100U2->GetXaxis()->CenterTitle();
06354   pAdcYvsX100U2->GetYaxis()->SetTitle("Y (m)");
06355   pAdcYvsX100U2->GetYaxis()->CenterTitle();
06356   
06357   TProfile2D* pAdcYvsX100V=new TProfile2D("pAdcYvsX100V","pAdcYvsX100V",
06358                                           nYvsX100,-4,4,nYvsX100,-4,4);
06359   pAdcYvsX100V->SetTitle("MEU");
06360   pAdcYvsX100V->GetXaxis()->SetTitle("X (m)");
06361   pAdcYvsX100V->GetXaxis()->CenterTitle();
06362   pAdcYvsX100V->GetYaxis()->SetTitle("Y (m)");
06363   pAdcYvsX100V->GetYaxis()->CenterTitle();
06364 
06365   TProfile2D* pAdcYvsX100V1=new TProfile2D("pAdcYvsX100V1","pAdcYvsX100V1",
06366                                            nYvsX100,-4,4,nYvsX100,-4,4);
06367   pAdcYvsX100V1->SetTitle("MEU");
06368   pAdcYvsX100V1->GetXaxis()->SetTitle("X (m)");
06369   pAdcYvsX100V1->GetXaxis()->CenterTitle();
06370   pAdcYvsX100V1->GetYaxis()->SetTitle("Y (m)");
06371   pAdcYvsX100V1->GetYaxis()->CenterTitle();
06372 
06373   TProfile2D* pAdcYvsX100V2=new TProfile2D("pAdcYvsX100V2","pAdcYvsX100V2",
06374                                            nYvsX100,-4,4,nYvsX100,-4,4);
06375   pAdcYvsX100V2->SetTitle("MEU");
06376   pAdcYvsX100V2->GetXaxis()->SetTitle("X (m)");
06377   pAdcYvsX100V2->GetXaxis()->CenterTitle();
06378   pAdcYvsX100V2->GetYaxis()->SetTitle("Y (m)");
06379   pAdcYvsX100V2->GetYaxis()->CenterTitle();
06380 
06381 
06382 
06383 
06384 
06385 
06386   TProfile2D* pPeYvsX100U=new TProfile2D("pPeYvsX100U","pPeYvsX100U",
06387                                           nYvsX100,-4,4,nYvsX100,-4,4);
06388   pPeYvsX100U->SetTitle("MEU");
06389   pPeYvsX100U->GetXaxis()->SetTitle("X (m)");
06390   pPeYvsX100U->GetXaxis()->CenterTitle();
06391   pPeYvsX100U->GetYaxis()->SetTitle("Y (m)");
06392   pPeYvsX100U->GetYaxis()->CenterTitle();
06393 
06394   TProfile2D* pPeYvsX100U1=new TProfile2D("pPeYvsX100U1","pPeYvsX100U1",
06395                                            nYvsX100,-4,4,nYvsX100,-4,4);
06396   pPeYvsX100U1->SetTitle("MEU1");
06397   pPeYvsX100U1->GetXaxis()->SetTitle("X (m)");
06398   pPeYvsX100U1->GetXaxis()->CenterTitle();
06399   pPeYvsX100U1->GetYaxis()->SetTitle("Y (m)");
06400   pPeYvsX100U1->GetYaxis()->CenterTitle();
06401 
06402   TProfile2D* pPeYvsX100U2=new TProfile2D("pPeYvsX100U2","pPeYvsX100U2",
06403                                            nYvsX100,-4,4,nYvsX100,-4,4);
06404   pPeYvsX100U2->SetTitle("MEU2");
06405   pPeYvsX100U2->GetXaxis()->SetTitle("X (m)");
06406   pPeYvsX100U2->GetXaxis()->CenterTitle();
06407   pPeYvsX100U2->GetYaxis()->SetTitle("Y (m)");
06408   pPeYvsX100U2->GetYaxis()->CenterTitle();
06409   
06410   TProfile2D* pPeYvsX100V=new TProfile2D("pPeYvsX100V","pPeYvsX100V",
06411                                           nYvsX100,-4,4,nYvsX100,-4,4);
06412   pPeYvsX100V->SetTitle("MEU");
06413   pPeYvsX100V->GetXaxis()->SetTitle("X (m)");
06414   pPeYvsX100V->GetXaxis()->CenterTitle();
06415   pPeYvsX100V->GetYaxis()->SetTitle("Y (m)");
06416   pPeYvsX100V->GetYaxis()->CenterTitle();
06417 
06418   TProfile2D* pPeYvsX100V1=new TProfile2D("pPeYvsX100V1","pPeYvsX100V1",
06419                                            nYvsX100,-4,4,nYvsX100,-4,4);
06420   pPeYvsX100V1->SetTitle("MEU");
06421   pPeYvsX100V1->GetXaxis()->SetTitle("X (m)");
06422   pPeYvsX100V1->GetXaxis()->CenterTitle();
06423   pPeYvsX100V1->GetYaxis()->SetTitle("Y (m)");
06424   pPeYvsX100V1->GetYaxis()->CenterTitle();
06425 
06426   TProfile2D* pPeYvsX100V2=new TProfile2D("pPeYvsX100V2","pPeYvsX100V2",
06427                                            nYvsX100,-4,4,nYvsX100,-4,4);
06428   pPeYvsX100V2->SetTitle("MEU");
06429   pPeYvsX100V2->GetXaxis()->SetTitle("X (m)");
06430   pPeYvsX100V2->GetXaxis()->CenterTitle();
06431   pPeYvsX100V2->GetYaxis()->SetTitle("Y (m)");
06432   pPeYvsX100V2->GetYaxis()->CenterTitle();
06434 
06435 
06436 
06438   Int_t nYvsX200=200;
06439   TH2F* hYvsX200=new TH2F
06440     ("hYvsX200","hYvsX200",nYvsX200,-4,4,nYvsX200,-4,4);
06441   hYvsX200->SetTitle("MEU");
06442   hYvsX200->GetXaxis()->SetTitle("X (m)");
06443   hYvsX200->GetXaxis()->CenterTitle();
06444   hYvsX200->GetYaxis()->SetTitle("Y (m)");
06445   hYvsX200->GetYaxis()->CenterTitle();
06446 
06447   TH2F* hYvsX200Vtx=new TH2F
06448     ("hYvsX200Vtx","hYvsX200Vtx",nYvsX200,-4,4,nYvsX200,-4,4);
06449   hYvsX200Vtx->SetTitle("MEU");
06450   hYvsX200Vtx->GetXaxis()->SetTitle("X (m)");
06451   hYvsX200Vtx->GetXaxis()->CenterTitle();
06452   hYvsX200Vtx->GetYaxis()->SetTitle("Y (m)");
06453   hYvsX200Vtx->GetYaxis()->CenterTitle();
06454 
06455   TH2F* hYvsX200End=new TH2F
06456     ("hYvsX200End","hYvsX200End",nYvsX200,-4,4,nYvsX200,-4,4);
06457   hYvsX200End->SetTitle("MEU");
06458   hYvsX200End->GetXaxis()->SetTitle("X (m)");
06459   hYvsX200End->GetXaxis()->CenterTitle();
06460   hYvsX200End->GetYaxis()->SetTitle("Y (m)");
06461   hYvsX200End->GetYaxis()->CenterTitle();
06462 
06463   TProfile2D* pYvsX200=new TProfile2D
06464     ("pYvsX200","pYvsX200",nYvsX200,-4,4,nYvsX200,-4,4);
06465   pYvsX200->SetTitle("MEU");
06466   pYvsX200->GetXaxis()->SetTitle("X (m)");
06467   pYvsX200->GetXaxis()->CenterTitle();
06468   pYvsX200->GetYaxis()->SetTitle("Y (m)");
06469   pYvsX200->GetYaxis()->CenterTitle();
06470 
06471   TH2F* hYvsX200U=new TH2F("hYvsX200U","hYvsX200U",nYvsX200,-4,4,nYvsX200,-4,4);
06472   hYvsX200U->SetTitle("MEU");
06473   hYvsX200U->GetXaxis()->SetTitle("X (m)");
06474   hYvsX200U->GetXaxis()->CenterTitle();
06475   hYvsX200U->GetYaxis()->SetTitle("Y (m)");
06476   hYvsX200U->GetYaxis()->CenterTitle();
06477 
06478   TProfile2D* pYvsX200U=new TProfile2D("pYvsX200U","pYvsX200U",
06479                                        nYvsX200,-4,4,nYvsX200,-4,4);
06480   pYvsX200U->SetTitle("MEU");
06481   pYvsX200U->GetXaxis()->SetTitle("X (m)");
06482   pYvsX200U->GetXaxis()->CenterTitle();
06483   pYvsX200U->GetYaxis()->SetTitle("Y (m)");
06484   pYvsX200U->GetYaxis()->CenterTitle();
06485 
06486   TProfile2D* pYvsX200U1=new TProfile2D("pYvsX200U1","pYvsX200U1",
06487                                         nYvsX200,-4,4,nYvsX200,-4,4);
06488   pYvsX200U1->SetTitle("MEU1");
06489   pYvsX200U1->GetXaxis()->SetTitle("X (m)");
06490   pYvsX200U1->GetXaxis()->CenterTitle();
06491   pYvsX200U1->GetYaxis()->SetTitle("Y (m)");
06492   pYvsX200U1->GetYaxis()->CenterTitle();
06493 
06494   TProfile2D* pYvsX200U2=new TProfile2D("pYvsX200U2","pYvsX200U2",
06495                                         nYvsX200,-4,4,nYvsX200,-4,4);
06496   pYvsX200U2->SetTitle("MEU2");
06497   pYvsX200U2->GetXaxis()->SetTitle("X (m)");
06498   pYvsX200U2->GetXaxis()->CenterTitle();
06499   pYvsX200U2->GetYaxis()->SetTitle("Y (m)");
06500   pYvsX200U2->GetYaxis()->CenterTitle();
06501 
06502   TH2F* hYvsX200V=new TH2F("hYvsX200V","hYvsX200V",nYvsX200,-4,4,nYvsX200,-4,4);
06503   hYvsX200V->SetTitle("MEU");
06504   hYvsX200V->GetXaxis()->SetTitle("X (m)");
06505   hYvsX200V->GetXaxis()->CenterTitle();
06506   hYvsX200V->GetYaxis()->SetTitle("Y (m)");
06507   hYvsX200V->GetYaxis()->CenterTitle();
06508 
06509   TProfile2D* pYvsX200V=new TProfile2D("pYvsX200V","pYvsX200V",
06510                                        nYvsX200,-4,4,nYvsX200,-4,4);
06511   pYvsX200V->SetTitle("MEU");
06512   pYvsX200V->GetXaxis()->SetTitle("X (m)");
06513   pYvsX200V->GetXaxis()->CenterTitle();
06514   pYvsX200V->GetYaxis()->SetTitle("Y (m)");
06515   pYvsX200V->GetYaxis()->CenterTitle();
06516 
06517   TProfile2D* pYvsX200V1=new TProfile2D("pYvsX200V1","pYvsX200V1",
06518                                         nYvsX200,-4,4,nYvsX200,-4,4);
06519   pYvsX200V1->SetTitle("MEU");
06520   pYvsX200V1->GetXaxis()->SetTitle("X (m)");
06521   pYvsX200V1->GetXaxis()->CenterTitle();
06522   pYvsX200V1->GetYaxis()->SetTitle("Y (m)");
06523   pYvsX200V1->GetYaxis()->CenterTitle();
06524 
06525   TProfile2D* pYvsX200V2=new TProfile2D("pYvsX200V2","pYvsX200V2",
06526                                         nYvsX200,-4,4,nYvsX200,-4,4);
06527   pYvsX200V2->SetTitle("MEU");
06528   pYvsX200V2->GetXaxis()->SetTitle("X (m)");
06529   pYvsX200V2->GetXaxis()->CenterTitle();
06530   pYvsX200V2->GetYaxis()->SetTitle("Y (m)");
06531   pYvsX200V2->GetYaxis()->CenterTitle();
06532 
06533   TProfile2D* pStsYvsX200U=new TProfile2D("pStsYvsX200U","pStsYvsX200U",
06534                                           nYvsX200,-4,4,nYvsX200,-4,4);
06535   pStsYvsX200U->SetTitle("MEU");
06536   pStsYvsX200U->GetXaxis()->SetTitle("X (m)");
06537   pStsYvsX200U->GetXaxis()->CenterTitle();
06538   pStsYvsX200U->GetYaxis()->SetTitle("Y (m)");
06539   pStsYvsX200U->GetYaxis()->CenterTitle();
06540   
06541   TProfile2D* pStsYvsX200U1=new TProfile2D("pStsYvsX200U1","pStsYvsX200U1",
06542                                            nYvsX200,-4,4,nYvsX200,-4,4);
06543   pStsYvsX200U1->SetTitle("MEU1");
06544   pStsYvsX200U1->GetXaxis()->SetTitle("X (m)");
06545   pStsYvsX200U1->GetXaxis()->CenterTitle();
06546   pStsYvsX200U1->GetYaxis()->SetTitle("Y (m)");
06547   pStsYvsX200U1->GetYaxis()->CenterTitle();
06548   
06549   TProfile2D* pStsYvsX200U2=new TProfile2D("pStsYvsX200U2","pStsYvsX200U2",
06550                                            nYvsX200,-4,4,nYvsX200,-4,4);
06551   pStsYvsX200U2->SetTitle("MEU2");
06552   pStsYvsX200U2->GetXaxis()->SetTitle("X (m)");
06553   pStsYvsX200U2->GetXaxis()->CenterTitle();
06554   pStsYvsX200U2->GetYaxis()->SetTitle("Y (m)");
06555   pStsYvsX200U2->GetYaxis()->CenterTitle();
06556 
06557   TProfile2D* pStsYvsX200U1Trk=new TProfile2D("pStsYvsX200U1Trk",
06558                                               "pStsYvsX200U1Trk",
06559                                               nYvsX200,-4,4,nYvsX200,-4,4);
06560   pStsYvsX200U1Trk->SetTitle("MEU");
06561   pStsYvsX200U1Trk->GetXaxis()->SetTitle("X (m)");
06562   pStsYvsX200U1Trk->GetXaxis()->CenterTitle();
06563   pStsYvsX200U1Trk->GetYaxis()->SetTitle("Y (m)");
06564   pStsYvsX200U1Trk->GetYaxis()->CenterTitle();
06565 
06566   TProfile2D* pStsYvsX200U2Trk=new TProfile2D("pStsYvsX200U2Trk",
06567                                               "pStsYvsX200U2Trk",
06568                                               nYvsX200,-4,4,nYvsX200,-4,4);
06569   pStsYvsX200U2Trk->SetTitle("MEU");
06570   pStsYvsX200U2Trk->GetXaxis()->SetTitle("X (m)");
06571   pStsYvsX200U2Trk->GetXaxis()->CenterTitle();
06572   pStsYvsX200U2Trk->GetYaxis()->SetTitle("Y (m)");
06573   pStsYvsX200U2Trk->GetYaxis()->CenterTitle();
06574 
06575   TProfile2D* pStsYvsX200V=new TProfile2D("pStsYvsX200V","pStsYvsX200V",
06576                                           nYvsX200,-4,4,nYvsX200,-4,4);
06577   pStsYvsX200V->SetTitle("MEU");
06578   pStsYvsX200V->GetXaxis()->SetTitle("X (m)");
06579   pStsYvsX200V->GetXaxis()->CenterTitle();
06580   pStsYvsX200V->GetYaxis()->SetTitle("Y (m)");
06581   pStsYvsX200V->GetYaxis()->CenterTitle();
06582 
06583   TProfile2D* pStsYvsX200V1=new TProfile2D("pStsYvsX200V1","pStsYvsX200V1",
06584                                            nYvsX200,-4,4,nYvsX200,-4,4);
06585   pStsYvsX200V1->SetTitle("MEU");
06586   pStsYvsX200V1->GetXaxis()->SetTitle("X (m)");
06587   pStsYvsX200V1->GetXaxis()->CenterTitle();
06588   pStsYvsX200V1->GetYaxis()->SetTitle("Y (m)");
06589   pStsYvsX200V1->GetYaxis()->CenterTitle();
06590 
06591   TProfile2D* pStsYvsX200V2=new TProfile2D("pStsYvsX200V2","pStsYvsX200V2",
06592                                            nYvsX200,-4,4,nYvsX200,-4,4);
06593   pStsYvsX200V2->SetTitle("MEU");
06594   pStsYvsX200V2->GetXaxis()->SetTitle("X (m)");
06595   pStsYvsX200V2->GetXaxis()->CenterTitle();
06596   pStsYvsX200V2->GetYaxis()->SetTitle("Y (m)");
06597   pStsYvsX200V2->GetYaxis()->CenterTitle();
06598 
06599   TProfile2D* pStsYvsX200V1Trk=new TProfile2D("pStsYvsX200V1Trk",
06600                                               "pStsYvsX200V1Trk",
06601                                               nYvsX200,-4,4,nYvsX200,-4,4);
06602   pStsYvsX200V1Trk->SetTitle("MEU");
06603   pStsYvsX200V1Trk->GetXaxis()->SetTitle("X (m)");
06604   pStsYvsX200V1Trk->GetXaxis()->CenterTitle();
06605   pStsYvsX200V1Trk->GetYaxis()->SetTitle("Y (m)");
06606   pStsYvsX200V1Trk->GetYaxis()->CenterTitle();
06607 
06608   TProfile2D* pStsYvsX200V2Trk=new TProfile2D("pStsYvsX200V2Trk",
06609                                               "pStsYvsX200V2Trk",
06610                                               nYvsX200,-4,4,nYvsX200,-4,4);
06611   pStsYvsX200V2Trk->SetTitle("MEU");
06612   pStsYvsX200V2Trk->GetXaxis()->SetTitle("X (m)");
06613   pStsYvsX200V2Trk->GetXaxis()->CenterTitle();
06614   pStsYvsX200V2Trk->GetYaxis()->SetTitle("Y (m)");
06615   pStsYvsX200V2Trk->GetYaxis()->CenterTitle();
06616 
06617   TProfile2D* pAdcYvsX200U=new TProfile2D("pAdcYvsX200U","pAdcYvsX200U",
06618                                           nYvsX200,-4,4,nYvsX200,-4,4);
06619   pAdcYvsX200U->SetTitle("MEU");
06620   pAdcYvsX200U->GetXaxis()->SetTitle("X (m)");
06621   pAdcYvsX200U->GetXaxis()->CenterTitle();
06622   pAdcYvsX200U->GetYaxis()->SetTitle("Y (m)");
06623   pAdcYvsX200U->GetYaxis()->CenterTitle();
06624 
06625   TProfile2D* pAdcYvsX200U1=new TProfile2D("pAdcYvsX200U1","pAdcYvsX200U1",
06626                                            nYvsX200,-4,4,nYvsX200,-4,4);
06627   pAdcYvsX200U1->SetTitle("MEU1");
06628   pAdcYvsX200U1->GetXaxis()->SetTitle("X (m)");
06629   pAdcYvsX200U1->GetXaxis()->CenterTitle();
06630   pAdcYvsX200U1->GetYaxis()->SetTitle("Y (m)");
06631   pAdcYvsX200U1->GetYaxis()->CenterTitle();
06632 
06633   TProfile2D* pAdcYvsX200U2=new TProfile2D("pAdcYvsX200U2","pAdcYvsX200U2",
06634                                            nYvsX200,-4,4,nYvsX200,-4,4);
06635   pAdcYvsX200U2->SetTitle("MEU2");
06636   pAdcYvsX200U2->GetXaxis()->SetTitle("X (m)");
06637   pAdcYvsX200U2->GetXaxis()->CenterTitle();
06638   pAdcYvsX200U2->GetYaxis()->SetTitle("Y (m)");
06639   pAdcYvsX200U2->GetYaxis()->CenterTitle();
06640   
06641   TProfile2D* pAdcYvsX200V=new TProfile2D("pAdcYvsX200V","pAdcYvsX200V",
06642                                           nYvsX200,-4,4,nYvsX200,-4,4);
06643   pAdcYvsX200V->SetTitle("MEU");
06644   pAdcYvsX200V->GetXaxis()->SetTitle("X (m)");
06645   pAdcYvsX200V->GetXaxis()->CenterTitle();
06646   pAdcYvsX200V->GetYaxis()->SetTitle("Y (m)");
06647   pAdcYvsX200V->GetYaxis()->CenterTitle();
06648 
06649   TProfile2D* pAdcYvsX200V1=new TProfile2D("pAdcYvsX200V1","pAdcYvsX200V1",
06650                                            nYvsX200,-4,4,nYvsX200,-4,4);
06651   pAdcYvsX200V1->SetTitle("MEU");
06652   pAdcYvsX200V1->GetXaxis()->SetTitle("X (m)");
06653   pAdcYvsX200V1->GetXaxis()->CenterTitle();
06654   pAdcYvsX200V1->GetYaxis()->SetTitle("Y (m)");
06655   pAdcYvsX200V1->GetYaxis()->CenterTitle();
06656 
06657   TProfile2D* pAdcYvsX200V2=new TProfile2D("pAdcYvsX200V2","pAdcYvsX200V2",
06658                                            nYvsX200,-4,4,nYvsX200,-4,4);
06659   pAdcYvsX200V2->SetTitle("MEU");
06660   pAdcYvsX200V2->GetXaxis()->SetTitle("X (m)");
06661   pAdcYvsX200V2->GetXaxis()->CenterTitle();
06662   pAdcYvsX200V2->GetYaxis()->SetTitle("Y (m)");
06663   pAdcYvsX200V2->GetYaxis()->CenterTitle();
06664 
06665   TProfile2D* pPeYvsX200U=new TProfile2D("pPeYvsX200U","pPeYvsX200U",
06666                                           nYvsX200,-4,4,nYvsX200,-4,4);
06667   pPeYvsX200U->SetTitle("MEU");
06668   pPeYvsX200U->GetXaxis()->SetTitle("X (m)");
06669   pPeYvsX200U->GetXaxis()->CenterTitle();
06670   pPeYvsX200U->GetYaxis()->SetTitle("Y (m)");
06671   pPeYvsX200U->GetYaxis()->CenterTitle();
06672 
06673   TProfile2D* pPeYvsX200U1=new TProfile2D("pPeYvsX200U1","pPeYvsX200U1",
06674                                            nYvsX200,-4,4,nYvsX200,-4,4);
06675   pPeYvsX200U1->SetTitle("MEU1");
06676   pPeYvsX200U1->GetXaxis()->SetTitle("X (m)");
06677   pPeYvsX200U1->GetXaxis()->CenterTitle();
06678   pPeYvsX200U1->GetYaxis()->SetTitle("Y (m)");
06679   pPeYvsX200U1->GetYaxis()->CenterTitle();
06680 
06681   TProfile2D* pPeYvsX200U2=new TProfile2D("pPeYvsX200U2","pPeYvsX200U2",
06682                                            nYvsX200,-4,4,nYvsX200,-4,4);
06683   pPeYvsX200U2->SetTitle("MEU2");
06684   pPeYvsX200U2->GetXaxis()->SetTitle("X (m)");
06685   pPeYvsX200U2->GetXaxis()->CenterTitle();
06686   pPeYvsX200U2->GetYaxis()->SetTitle("Y (m)");
06687   pPeYvsX200U2->GetYaxis()->CenterTitle();
06688   
06689   TProfile2D* pPeYvsX200V=new TProfile2D("pPeYvsX200V","pPeYvsX200V",
06690                                           nYvsX200,-4,4,nYvsX200,-4,4);
06691   pPeYvsX200V->SetTitle("MEU");
06692   pPeYvsX200V->GetXaxis()->SetTitle("X (m)");
06693   pPeYvsX200V->GetXaxis()->CenterTitle();
06694   pPeYvsX200V->GetYaxis()->SetTitle("Y (m)");
06695   pPeYvsX200V->GetYaxis()->CenterTitle();
06696 
06697   TProfile2D* pPeYvsX200V1=new TProfile2D("pPeYvsX200V1","pPeYvsX200V1",
06698                                            nYvsX200,-4,4,nYvsX200,-4,4);
06699   pPeYvsX200V1->SetTitle("MEU");
06700   pPeYvsX200V1->GetXaxis()->SetTitle("X (m)");
06701   pPeYvsX200V1->GetXaxis()->CenterTitle();
06702   pPeYvsX200V1->GetYaxis()->SetTitle("Y (m)");
06703   pPeYvsX200V1->GetYaxis()->CenterTitle();
06704 
06705   TProfile2D* pPeYvsX200V2=new TProfile2D("pPeYvsX200V2","pPeYvsX200V2",
06706                                            nYvsX200,-4,4,nYvsX200,-4,4);
06707   pPeYvsX200V2->SetTitle("MEU");
06708   pPeYvsX200V2->GetXaxis()->SetTitle("X (m)");
06709   pPeYvsX200V2->GetXaxis()->CenterTitle();
06710   pPeYvsX200V2->GetYaxis()->SetTitle("Y (m)");
06711   pPeYvsX200V2->GetYaxis()->CenterTitle();
06713 
06714 
06715   TProfile2D* pCosThZYvsX=new TProfile2D
06716     ("pCosThZYvsX","pCosThZYvsX",30,-4,4,30,-4,4);
06717   pCosThZYvsX->SetTitle("Cos(#theta_{z})");
06718   pCosThZYvsX->GetXaxis()->SetTitle("X (m)");
06719   pCosThZYvsX->GetXaxis()->CenterTitle();
06720   pCosThZYvsX->GetYaxis()->SetTitle("Y (m)");
06721   pCosThZYvsX->GetYaxis()->CenterTitle();
06722 
06723   TProfile2D* pCosThZPosYvsX=new TProfile2D
06724     ("pCosThZPosYvsX","pCosThZPosYvsX",30,-4,4,30,-4,4);
06725   pCosThZPosYvsX->SetTitle("Cos(#theta_{z})");
06726   pCosThZPosYvsX->GetXaxis()->SetTitle("X (m)");
06727   pCosThZPosYvsX->GetXaxis()->CenterTitle();
06728   pCosThZPosYvsX->GetYaxis()->SetTitle("Y (m)");
06729   pCosThZPosYvsX->GetYaxis()->CenterTitle();
06730 
06731   TProfile2D* pCosThZNegYvsX=new TProfile2D
06732     ("pCosThZNegYvsX","pCosThZNegYvsX",30,-4,4,30,-4,4);
06733   pCosThZNegYvsX->SetTitle("Cos(#theta_{z})");
06734   pCosThZNegYvsX->GetXaxis()->SetTitle("X (m)");
06735   pCosThZNegYvsX->GetXaxis()->CenterTitle();
06736   pCosThZNegYvsX->GetYaxis()->SetTitle("Y (m)");
06737   pCosThZNegYvsX->GetYaxis()->CenterTitle();
06738 
06739   Int_t startTimeSecs=2000000000;//2 billion
06740   Int_t endTimeSecs=1;
06741   vector<Double_t> vTimeSec;
06742   vTimeSec.reserve(fEntries);//save lots of actual push backs
06743   vector<Double_t> vWinSigMap;
06744   vWinSigMap.reserve(fEntries);
06745   vector<Double_t> vWinSigMapDrift;
06746   vWinSigMapDrift.reserve(fEntries);
06747   vector<Double_t> vWinSigMapDriftX;
06748   vWinSigMapDriftX.reserve(fEntries);
06749 
06750   vector<Double_t> vTimeSecCosTh;
06751   vTimeSec.reserve(fEntries);//save lots of actual push backs
06752   vector<Double_t> vWinSigMapCosTh;
06753   vWinSigMapCosTh.reserve(fEntries);
06754   vector<Double_t> vWinSigMapCosThDrift;
06755   vWinSigMapCosThDrift.reserve(fEntries);
06756   vector<Double_t> vWinSigMapCosThDriftX;
06757   vWinSigMapCosThDriftX.reserve(fEntries);
06758 
06759   vector<Double_t> vWinSigCorCosTh;
06760   vWinSigCorCosTh.reserve(fEntries);
06761   vector<Double_t> vWinSigLinCosTh;
06762   vWinSigLinCosTh.reserve(fEntries);
06763   vector<Double_t> vWinAdcCosTh;
06764   vWinAdcCosTh.reserve(fEntries);
06765   vector<Double_t> vWinPeCosTh;
06766   vWinPeCosTh.reserve(fEntries);
06767   vector<Double_t> vWinSigLinOnlyCosTh;
06768   vWinSigLinOnlyCosTh.reserve(fEntries);
06769   vector<Double_t> vWinSigDrfCosTh;
06770   vWinSigDrfCosTh.reserve(fEntries);
06771 
06772   vector<Double_t> vTimeSecTemp;
06773   vTimeSecTemp.reserve(fEntries);//save lots of actual push backs
06774   vector<Double_t> vWinSigMapTemp;
06775   vWinSigMapTemp.reserve(fEntries);
06776   vector<Double_t> vTemperatures;
06777   vTemperatures.reserve(fEntries);
06778 
06779   vector<Double_t> vCrateMask;
06780   vector<Double_t> vBusyChips;
06781   vector<Double_t> vColdChips;
06782   vector<Double_t> vDataQuality;
06783 
06784   TStopwatch stopWatchAll;
06785   TStopwatch stopWatchDrf;
06786   stopWatchAll.Start();
06787   stopWatchDrf.Start();
06788 
06789   TH1F* hRealTimeAll=new TH1F("hRealTimeAll","hRealTimeAll",
06790                               11000,-0.1,1);
06791   hRealTimeAll->SetFillColor(0);
06792   hRealTimeAll->SetTitle("Real Time of Event");
06793   hRealTimeAll->GetXaxis()->SetTitle("Real Time (s)");
06794   hRealTimeAll->GetXaxis()->CenterTitle();
06795   //hRealTimeAll->SetBit(TH1::kCanRebin);
06796 
06797   TH1F* hCpuTimeAll=new TH1F("hCpuTimeAll","hCpuTimeAll",
06798                              11000,-0.1,1);
06799   hCpuTimeAll->SetFillColor(0);
06800   hCpuTimeAll->SetTitle("Cpu Time of Event");
06801   hCpuTimeAll->GetXaxis()->SetTitle("Cpu Time (s)");
06802   hCpuTimeAll->GetXaxis()->CenterTitle();
06803   //hCpuTimeAll->SetBit(TH1::kCanRebin);
06804 
06805   TH1F* hRealTimeDrf=new TH1F("hRealTimeDrf","hRealTimeDrf",
06806                               11000,-0.1,1);
06807   hRealTimeDrf->SetFillColor(0);
06808   hRealTimeDrf->SetTitle("Real Time of Drift Cal.");
06809   hRealTimeDrf->GetXaxis()->SetTitle("Real Time (s)");
06810   hRealTimeDrf->GetXaxis()->CenterTitle();
06811   //hRealTimeDrf->SetBit(TH1::kCanRebin);
06812 
06813   TH1F* hCpuTimeDrf=new TH1F("hCpuTimeDrf","hCpuTimeDrf",
06814                              11000,-0.1,1);
06815   hCpuTimeDrf->SetFillColor(0);
06816   hCpuTimeDrf->SetTitle("Cpu Time of Drift Cal.");
06817   hCpuTimeDrf->GetXaxis()->SetTitle("Cpu Time (s)");
06818   hCpuTimeDrf->GetXaxis()->CenterTitle();
06819   //hCpuTimeDrf->SetBit(TH1::kCanRebin);
06820 
06821   const MeuCuts cuts;
06822 
06826   
06827   this->InitialiseLoopVariables();  
06828   
06829   for(Int_t entry=0;entry<fEntries;entry++){
06830     
06831     //measure time per event
06832     stopWatchAll.Stop();
06833     if (entry>0) {
06834       hRealTimeAll->Fill(stopWatchAll.RealTime());
06835       hCpuTimeAll->Fill(stopWatchAll.CpuTime());
06836     }
06837     stopWatchAll.Start();
06838 
06839     this->SetLoopVariables(entry);
06840 
06841     MeuSummary& t=(*fMeuSummary);
06842 
06843     if (!t.GoodDataQuality&&t.SimFlag==1) continue;
06844 
06845     //record which detector and simflag - useful in plotting macros
06846     hDetector->Fill(t.Detector);
06847     hSimFlag->Fill(t.SimFlag);
06848 
06849     if (t.WinStopSideX>2.5 || t.WinStopSideY<-1.4){
06850       MAXMSG("MeuPlots",Msg::kDebug,200)
06851         <<"t.WinStopSideX="<<t.WinStopSideX
06852         <<", t.WinStopSideY="<<t.WinStopSideY
06853         <<", snarl="<<t.Snarl<<", run="<<t.Run<<endl;
06854     }
06855     //else continue;
06856     
06857     //reversed field (r25768)
06858     //field forward again (r29094)
06859     Bool_t reversedBField=false;
06860     if (t.Detector==Detector::kFar){
06861       reversedBField=t.Run>=25768 && t.Run<29094;
06862     }
06863     
06864     Float_t avX=0.5*(t.WinStopSideX+t.WinVtxSideX);
06865     Float_t avY=0.5*(t.WinStopSideY+t.WinVtxSideY);
06866     MAXMSG("MeuPlots",Msg::kDebug,50)
06867       <<"avX="<<avX<<", X1="<<t.WinStopSideX
06868       <<", X2="<<t.WinVtxSideX<<endl
06869       <<"avY="<<avY<<", Y1="<<t.WinStopSideY
06870       <<", Y2="<<t.WinVtxSideY<<endl;
06871 
06872     //only use august onwards - Phil S used Aug-Oct 2004 for sts cal.
06873     //if (t.TimeSec<1091318400) continue;
06874 
06875     hCrateMask->Fill(t.CrateMask);
06876     hBusyChips->Fill(t.BusyChips);
06877     hColdChips->Fill(t.ColdChips);
06878     hDataQuality->Fill(int(t.GoodDataQuality));
06879 
06880     hSigMapAll->Fill(t.WinSigMap);
06881     pLowEnVsCosThZ->Fill(t.WinAvCosThetaZ,t.MCLowEn);
06882     hCosThZ->Fill(t.WinAvCosThetaZ);
06883     hYvsXVtx->Fill(t.VtxX,t.VtxY);
06884     hYvsXEnd->Fill(t.EndX,t.EndY);
06885     if ((t.VtxPlane-1)%5==0) hYvsXFVtx->Fill(t.VtxX,t.VtxY);
06886     else hYvsXPVtx->Fill(t.VtxX,t.VtxY);
06887     if ((t.EndPlane-1)%5==0) hYvsXFEnd->Fill(t.EndX,t.EndY);   
06888     else hYvsXPEnd->Fill(t.EndX,t.EndY);
06889     
06890     hYvsX100Vtx->Fill(t.VtxX,t.VtxY);
06891     hYvsX100End->Fill(t.EndX,t.EndY);
06892     hYvsX200Vtx->Fill(t.VtxX,t.VtxY);
06893     hYvsX200End->Fill(t.EndX,t.EndY);
06894 
06895     if (reversedBField) hCosThZBBack->Fill(t.WinAvCosThetaZ);
06896     else hCosThZBForw->Fill(t.WinAvCosThetaZ);
06897 
06898     Int_t evTime=t.TimeSec;
06899 
06900     //get the min and max times
06901     if (evTime>endTimeSecs) endTimeSecs=evTime;
06902     if (evTime<startTimeSecs && evTime>0) startTimeSecs=evTime;
06903     if (evTime<=0) {
06904       cout<<"Bad time="<<evTime<<endl;
06905     }
06906     
06907     //convert to 1995 time
06908     MAXMSG("MeuPlots",Msg::kInfo,3)
06909       <<"Filling time vector="<<evTime;
06910     this->EpochTo1995(evTime);
06911     MAXMSG("MeuPlots",Msg::kInfo,3)
06912       <<", secs from 1995="<<evTime<<endl;
06913 
06914     //this section is to figure out the Daikon MC bug where
06915     //the MC was calibrated rather than decalibrated for drift
06916     //and also test the calibration groups new fudge function
06917     Float_t driftFudge=1;
06918     t.ReleaseType=ReleaseType::kCedar+ReleaseType::kDaikon;
06919     this->CalibrationGroupEnergyCorrections(driftFudge,t);
06920     //this->DriftDecalTwice(winSigMapDriftX,t);
06921     
06922     //apply the angle cut to get the real MEU value
06923     if (fabs(t.WinAvCosThetaZ)>0.3){
06924       hAvNumDigits->Fill(t.WinAvNumDigits);
06925       hAvNumDigitsAll->Fill(t.WinAvNumDigits);
06926       hAvNumStrips->Fill(t.WinAvNumStrips);
06927       hAvNumStripsAll->Fill(t.WinAvNumStrips);
06928       hAdc->Fill(t.WinAdc);
06929       hPe->Fill(t.WinPe);
06930       hSigLin->Fill(t.WinSigLin);
06931       //hSigLinDrf->Fill(t.WinSigDrf);
06932       //hSigLinOnly->Fill(t.WinSigLinOnly);
06933       hSigCor->Fill(t.WinSigCor);
06934       hSigMap->Fill(t.WinSigMap);
06935       hSigMapNoThresh->Fill(t.WinSigMap);
06936       hSigMapDriftX->Fill(t.WinSigMap*driftFudge);
06937 
06938       vTimeSecCosTh.push_back(evTime);
06939 
06940       vWinSigMapCosTh.push_back(t.WinSigMap);
06941       vWinSigCorCosTh.push_back(t.WinSigCor);
06942       vWinSigLinCosTh.push_back(t.WinSigLin);
06943       vWinAdcCosTh.push_back(t.WinAdc);
06944       vWinPeCosTh.push_back(t.WinPe);
06945       //these two not implemented in MeuSummary.cxx until 09/May/07
06946       //vWinSigLinOnlyCosTh.push_back(t.WinSigLinOnly);
06947       //vWinSigDrfCosTh.push_back(t.WinSigDrf);
06948       
06949       stopWatchDrf.Start();
06950       Float_t winSigMapDrift=t.WinSigMap;
06951       this->DriftCalibrate(winSigMapDrift,t);
06952       stopWatchDrf.Stop();
06953       hRealTimeDrf->Fill(stopWatchDrf.RealTime());
06954       hCpuTimeDrf->Fill(stopWatchDrf.CpuTime());
06955       vWinSigMapCosThDrift.push_back(winSigMapDrift);
06956 
06957       Float_t driftRatio=-1;
06958       if (winSigMapDrift) driftRatio=t.WinSigMap/winSigMapDrift;
06959 
06960       Float_t extraDriftRatio=(driftRatio-1)*1.35;
06961       extraDriftRatio+=1;
06962       Float_t winSigMapDriftX=t.WinSigMap;
06963       winSigMapDriftX*=(1./extraDriftRatio);
06964       vWinSigMapCosThDriftX.push_back(winSigMapDriftX);
06965 
06966       hMatTrav->Fill(t.TotalMatTraversed);
06967       hLowEn->Fill(t.MCLowEn);
06968       hHighEn->Fill(t.MCHighEn);
06969       
06970       if (t.MCLowEn<1){//only fill if <1 GeV
06971         pLowEnVsX->Fill(t.WinStopSideX,t.MCLowEn);
06972         pLowEnVsY->Fill(t.WinStopSideY,t.MCLowEn);
06973         hLowEnVsX->Fill(t.WinStopSideX,t.MCLowEn);
06974         hLowEnVsY->Fill(t.WinStopSideY,t.MCLowEn);
06975       }
06976 
06977       if (t.MCParticleId==13) hSigMapMuMinus->Fill(t.WinSigMap);
06978       else if (t.MCParticleId==-13) hSigMapMuPlus->Fill(t.WinSigMap);
06979 
06980       if (t.SM1) hSigMapSM1->Fill(t.WinSigMap);
06981       if (t.SM2) hSigMapSM2->Fill(t.WinSigMap);
06982       
06983       if (t.WinAvCosThetaZ>0) hSigMapForw->Fill(t.WinSigMap);
06984       if (t.WinAvCosThetaZ<0) hSigMapBack->Fill(t.WinSigMap);
06985 
06986       //fill for the B field direction
06987       if (reversedBField) hSigMapBBack->Fill(t.WinSigMap);
06988       else hSigMapBForw->Fill(t.WinSigMap);
06989     }
06990    
06991     //if there was a good window
06992     if (t.WinSigMap>0 && t.WinSigMap<3000 && 
06993         fabs(t.WinAvCosThetaZ)>0.3){//get rid of crazies
06994 
06995       pYvsXMeu->Fill(avX,avY,t.WinSigMap);
06996 
06997       vTimeSec.push_back(evTime);
06998       vWinSigMap.push_back(t.WinSigMap);
06999       
07000       Float_t winSigMapDrift=t.WinSigMap;
07001       this->DriftCalibrate(winSigMapDrift,t);
07002       vWinSigMapDrift.push_back(winSigMapDrift);
07003 
07004       //this was the section to try and figure out the size of the 
07005       //"over compensation" issue
07006       //Float_t driftRatio=-1;
07007       //if (winSigMapDrift) driftRatio=t.WinSigMap/winSigMapDrift;
07008       //Float_t extraDriftRatio=(driftRatio-1)*1.35;
07009       //extraDriftRatio+=1;
07010       //Float_t winSigMapDriftX=t.WinSigMap;
07011       //winSigMapDriftX*=(1./extraDriftRatio);
07012 
07013       Float_t winSigMapDriftX=t.WinSigMap*driftFudge;
07014       
07015       //fill the vector
07016       vWinSigMapDriftX.push_back(winSigMapDriftX);
07017 
07018       if (t.Temperature>0){
07019         vTemperatures.push_back(t.Temperature);
07020         vTimeSecTemp.push_back(evTime);
07021         vWinSigMapTemp.push_back(t.WinSigMap);
07022       }
07023 
07024       vCrateMask.push_back(t.CrateMask);
07025       vBusyChips.push_back(t.BusyChips);
07026       vColdChips.push_back(t.ColdChips);
07027       vDataQuality.push_back(int(t.GoodDataQuality));
07028     }
07029 
07030     if (t.WinSigMap>0 && t.WinSigMap<3000 && !reversedBField) {
07031       //have to avoid the case where cosThZ is exactly 1
07032       Int_t index=static_cast<Int_t>((t.WinAvCosThetaZ*0.999999+1)*10);
07033       MAXMSG("MeuPlots",Msg::kVerbose,400)
07034         <<"Using index="<<index<<endl;
07035       meuCosTh[index]->Fill(t.WinSigMap);
07036     }
07037 
07038     Float_t meuU1=0;
07039     Float_t meuU2=0;
07040     Float_t meuV1=0;
07041     Float_t meuV2=0;
07042 
07043     Float_t meuSM1U1=0;
07044     Float_t meuSM1U2=0;
07045     Float_t meuSM1V1=0;
07046     Float_t meuSM1V2=0;
07047     Float_t meuSM2U1=0;
07048     Float_t meuSM2U2=0;
07049     Float_t meuSM2V1=0;
07050     Float_t meuSM2V2=0;
07051 
07052     Float_t meuPeRaw=0;//the raw light level, not PL corrected
07053     
07054     Float_t GeVPerMeu=0;
07055 
07056     Int_t planeCounter=0;
07057     Int_t uCounter=0;
07058     Int_t vCounter=0;
07059 
07060     MAXMSG("MeuPlots",Msg::kInfo,20)
07061       <<"fWinVtxSidePl="<<t.WinVtxSidePl
07062       <<", fWinStopSidePl="<<t.WinStopSidePl
07063       <<endl;
07064     Bool_t posDir=t.WinStopSidePl>t.WinVtxSidePl;
07065     Float_t totalPLCor=0;
07066     if (posDir) totalPLCor=14;//average number of planes at win edge
07067     Float_t sigDrfWin=0;
07068     Float_t sigLinOnlyWin=0;
07069     Float_t meuWinCor=0;
07070     Float_t meuWinCorCounter=0;
07071 
07073     //loop over MeuHitInfo hits
07075     TClonesArray& meuHits=(*t.MeuHitInfo);
07076     Int_t numHits=meuHits.GetEntries();
07077     //loop over the truth hits
07078     for (Int_t hit=0;hit<numHits;hit++){
07079       MAXMSG("MeuPlots",Msg::kInfo,3)
07080         <<"Looping over MeuHitInfo entries, numEntries="<<numHits<<endl;
07081 
07082       const MeuHitInfo* meuHit=
07083         dynamic_cast<MeuHitInfo*>(meuHits[hit]);
07084       const MeuHitInfo& cp=(*meuHit);
07085       Int_t pl=cp.Plane;
07086 
07087       //calc the strip from tpos given not all planes have a strip
07088       Float_t tposStrip=-1;
07089       if (t.Detector==Detector::kFar) {
07090         tposStrip=(cp.TPos+4)*192./8;
07091       }
07092       else if (t.Detector==Detector::kNear) {
07093         //this is not right yet...
07094         if (cp.View==PlaneView::kU) tposStrip=cp.Strip;
07095         else if (cp.View==PlaneView::kV) tposStrip=cp.Strip;
07096       } 
07097       else cout<<"Detector type not recognised"<<endl;
07098 
07099       Float_t u=cp.TPos;
07100       Float_t v=cp.LPos;
07101       if (cp.View==PlaneView::kV){
07102         u=cp.LPos;
07103         v=cp.TPos;
07104       }
07105 
07106       //gevpermip stuff
07107       planeCounter++;
07108       GeVPerMeu+=cp.MCEnDep/cp.PLCor;
07109       meuPeRaw+=cp.Pe;
07110 
07111       //efficiency plots
07112       if (cp.SigMap==0) pEffVsPl->Fill(pl,0);
07113       else pEffVsPl->Fill(pl,1);
07114       if (cp.Strip<0) pEffTrkVsPl->Fill(pl,0);
07115       else pEffTrkVsPl->Fill(pl,1);
07116       
07117       //cos thz plots
07118       pCosThZYvsX->Fill(cp.X,cp.Y,fabs(t.WinAvCosThetaZ));
07119       if (t.WinAvCosThetaZ>=0) {
07120         pCosThZPosYvsX->Fill(cp.X,cp.Y,fabs(t.WinAvCosThetaZ));
07121       }
07122       else pCosThZNegYvsX->Fill(cp.X,cp.Y,fabs(t.WinAvCosThetaZ));
07123 
07124       //make a 6% correction for dE/dx changing in the window
07125       //Float_t corFact=-0.0043*totalPLCor+1;
07126       Float_t corFact=-0.0043*totalPLCor+1.03;
07127       Float_t meuSigMapCor=corFact*cp.SigMap/cp.PLCor;
07128       Float_t meuSigMapCor1=corFact*cp.SigMap1/cp.PLCor;
07129       Float_t meuSigMapCor2=corFact*cp.SigMap2/cp.PLCor;
07130       Float_t meuSigCorCor=corFact*cp.SigCor/cp.PLCor;
07131       Float_t meuSigCorCor1=corFact*cp.SigCor1/cp.PLCor;
07132       Float_t meuSigCorCor2=corFact*cp.SigCor2/cp.PLCor;
07133       Float_t meuSigCorTrkCor1=corFact*cp.SigCorTrk1/cp.PLCor;
07134       Float_t meuSigCorTrkCor2=corFact*cp.SigCorTrk2/cp.PLCor;
07135       Float_t meuSigLinCor=corFact*cp.SigLin/cp.PLCor;
07136       Float_t meuSigLinCor1=corFact*cp.SigLin1/cp.PLCor;
07137       Float_t meuSigLinCor2=corFact*cp.SigLin2/cp.PLCor;
07138       Float_t meuSigPeCor=corFact*cp.Pe/cp.PLCor;
07139       Float_t meuSigPeCor1=corFact*cp.Pe1/cp.PLCor;
07140       Float_t meuSigPeCor2=corFact*cp.Pe2/cp.PLCor;
07141       Float_t meuAdcCor=corFact*cp.Adc/cp.PLCor;
07142       Float_t meuAdcCor1=corFact*cp.Adc1/cp.PLCor;
07143       Float_t meuAdcCor2=corFact*cp.Adc2/cp.PLCor;
07144       sigDrfWin+=cp.SigDrf/cp.PLCor;
07145       sigLinOnlyWin+=cp.SigLinOnly/cp.PLCor;
07146       meuWinCor+=meuSigMapCor;
07147       meuWinCorCounter++;
07148       MAXMSG("MeuPlots",Msg::kDebug,200)
07149         <<"pl="<<pl<<", totPLC="<<totalPLCor
07150         <<", PLC="<<cp.PLCor
07151         <<", meu="<<cp.SigMap/cp.PLCor
07152         <<", meuCor="<<meuSigMapCor
07153         <<", cor="<<corFact
07154         <<endl;
07155       if (posDir) totalPLCor-=cp.PLCor;
07156       else totalPLCor+=cp.PLCor;
07157       
07158       //do the drift calibration
07159       Float_t meuSigMapDriftCor=corFact*cp.SigMap/cp.PLCor;
07160       Float_t meuSigMapDriftCor1=corFact*cp.SigMap1/cp.PLCor;
07161       Float_t meuSigMapDriftCor2=corFact*cp.SigMap2/cp.PLCor;
07162       Float_t meuSigMapDriftXCor=corFact*cp.SigMap/cp.PLCor;
07163       Float_t meuSigMapDriftXCor1=corFact*cp.SigMap1/cp.PLCor;
07164       Float_t meuSigMapDriftXCor2=corFact*cp.SigMap2/cp.PLCor;
07165       Bool_t doDriftCal=true;
07166       if (doDriftCal){
07167         this->DriftCalibrate(meuSigMapDriftCor,t);
07168         this->DriftCalibrate(meuSigMapDriftCor1,t);
07169         this->DriftCalibrate(meuSigMapDriftCor2,t);
07170         
07171         Float_t ratio=-1;
07172         if (meuSigMapDriftCor) ratio=meuSigMapCor/meuSigMapDriftCor;
07173 
07174         Float_t extraDriftRatio=(ratio-1)*1.35;
07175         extraDriftRatio+=1;
07176         Float_t invExtraDriftRatio=(1./extraDriftRatio);
07177         meuSigMapDriftXCor*=invExtraDriftRatio;
07178         meuSigMapDriftXCor1*=invExtraDriftRatio;
07179         meuSigMapDriftXCor2*=invExtraDriftRatio;
07180 
07181         MAXMSG("MeuPlots",Msg::kDebug,200)
07182           <<"Drift Cal: new="<<meuSigMapDriftCor
07183           <<", old="<<meuSigMapCor
07184           <<", response="<<ratio<<endl
07185           <<"Extra Drift Cal: new="<<meuSigMapDriftXCor
07186           <<", old="<<meuSigMapCor
07187           <<", response="<<extraDriftRatio
07188           <<endl;
07189       }
07190 
07191       //calc MEU for the 4 different stripends
07192       //don't use meuSigMapCor for these - not used in profiles
07193       if (cp.View==2){
07194         meuU1+=cp.SigMap1/cp.PLCor;
07195         meuU2+=cp.SigMap2/cp.PLCor;
07196 
07197         if (t.SM1) {
07198           meuSM1U1+=cp.SigMap1/cp.PLCor;
07199           meuSM1U2+=cp.SigMap2/cp.PLCor;
07200         }
07201         else if (t.SM2) {
07202           meuSM2U1+=cp.SigMap1/cp.PLCor;
07203           meuSM2U2+=cp.SigMap2/cp.PLCor;
07204         }
07205         uCounter++;
07206       }
07207       else if (cp.View==3){      
07208         meuV1+=cp.SigMap1/cp.PLCor;
07209         meuV2+=cp.SigMap2/cp.PLCor;
07210 
07211         if (t.SM1) {
07212           meuSM1V1+=cp.SigMap1/cp.PLCor;
07213           meuSM1V2+=cp.SigMap2/cp.PLCor;
07214         }
07215         else if (t.SM2) {
07216           meuSM2V1+=cp.SigMap1/cp.PLCor;
07217           meuSM2V2+=cp.SigMap2/cp.PLCor;
07218         }
07219         vCounter++;
07220       }
07221 
07222       //now fill loads of profiles
07223       //if there was a good window
07224       if (t.WinSigMap>0 && t.WinSigMap<3000 && 
07225           fabs(t.WinAvCosThetaZ)>0.5){
07226 
07227         if (cp.SigMap/cp.PLCor<3000){
07228           pMeuVsPl->Fill(pl,meuSigMapCor);
07229           pPeVsPl->Fill(pl,meuSigPeCor);
07230           pStsVsPl->Fill(pl,meuSigCorCor);
07231           pSLVsPl->Fill(pl,meuSigLinCor);
07232           pAdcVsPl->Fill(pl,meuAdcCor);
07233           
07234           pMeuVsPl1->Fill(pl,meuSigMapCor1);
07235           pPeVsPl1->Fill(pl,meuSigPeCor1);
07236           pStsVsPl1->Fill(pl,meuSigCorCor1);
07237           pSLVsPl1->Fill(pl,meuSigLinCor1);
07238           pAdcVsPl1->Fill(pl,meuAdcCor1);
07239 
07240           pMeuVsPl2->Fill(pl,meuSigMapCor2);
07241           pPeVsPl2->Fill(pl,meuSigPeCor2);
07242           pStsVsPl2->Fill(pl,meuSigCorCor2);
07243           pSLVsPl2->Fill(pl,meuSigLinCor2);
07244           pAdcVsPl2->Fill(pl,meuAdcCor2);
07245           
07246           pMeuVsPl4->Fill(pl,meuSigMapCor);
07247           pPeVsPl4->Fill(pl,meuSigPeCor);
07248           pStsVsPl4->Fill(pl,meuSigCorCor);
07249           pSLVsPl4->Fill(pl,meuSigLinCor);
07250           pAdcVsPl4->Fill(pl,meuAdcCor);
07251 
07252           pMeuVsPl8->Fill(pl,meuSigMapCor);
07253           pPeVsPl8->Fill(pl,meuSigPeCor);
07254           pStsVsPl8->Fill(pl,meuSigCorCor);
07255           pSLVsPl8->Fill(pl,meuSigLinCor);
07256           pAdcVsPl8->Fill(pl,meuAdcCor);
07257 
07258           pMeuVsPl16->Fill(pl,meuSigMapCor);
07259           pPeVsPl16->Fill(pl,meuSigPeCor);
07260           pStsVsPl16->Fill(pl,meuSigCorCor);
07261           pSLVsPl16->Fill(pl,meuSigLinCor);
07262           pAdcVsPl16->Fill(pl,meuAdcCor);
07263 
07264           //the time when Phil S. did his calibration
07265           if (t.TimeSec>1091318400) {
07266             pMeuVsPlT16->Fill(pl,meuSigMapCor);
07267             pStsVsPlT16->Fill(pl,meuSigCorCor);
07268             pSLVsPlT16->Fill(pl,meuSigLinCor);
07269             pAdcVsPlT16->Fill(pl,meuAdcCor);
07270           }
07271 
07272           pMeuVsX->Fill(cp.X,meuSigMapCor);
07273           pMeuVsY->Fill(cp.Y,meuSigMapCor);
07274           pMeuVs40X->Fill(cp.X,meuSigMapCor);
07275           pMeuVs40Y->Fill(cp.Y,meuSigMapCor);
07276           
07277           hYvsX->Fill(cp.X,cp.Y);
07278           pYvsX->Fill(cp.X,cp.Y,meuSigMapCor);
07279           pAdcYvsX->Fill(cp.X,cp.Y,meuAdcCor);
07280           pStsYvsX->Fill(cp.X,cp.Y,meuSigCorCor);
07281           pPeYvsX->Fill(cp.X,cp.Y,meuSigPeCor);
07282           if ((pl-1)%5==0) {
07283             hYvsXF->Fill(cp.X,cp.Y);
07284             pYvsXF->Fill(cp.X,cp.Y,meuSigMapCor);
07285           }
07286           else {
07287             hYvsXP->Fill(cp.X,cp.Y);
07288             pYvsXP->Fill(cp.X,cp.Y,meuSigMapCor);
07289           }
07290 
07291           hYvsX15->Fill(cp.X,cp.Y);
07292           pYvsX15->Fill(cp.X,cp.Y,meuSigMapCor);
07293 
07294           pYvsX20->Fill(cp.X,cp.Y,meuSigMapCor);
07295           pYvsX22->Fill(cp.X,cp.Y,meuSigMapCor);
07296           pYvsX25->Fill(cp.X,cp.Y,meuSigMapCor);
07297 
07298           hYvsX16->Fill(cp.X,cp.Y);
07299           pYvsX16->Fill(cp.X,cp.Y,meuSigMapCor);
07300 
07301           hYvsX30->Fill(cp.X,cp.Y);
07302           pYvsX30->Fill(cp.X,cp.Y,meuSigMapCor);
07303 
07304           hYvsX100->Fill(cp.X,cp.Y);
07305           pYvsX100->Fill(cp.X,cp.Y,meuSigMapCor);
07306           Float_t z=1;//don't cut on z for now
07307           if (cuts.IsInPittFidVol(cp.X,cp.Y,z,u,v)) {
07308             pYvsXPittZ100->Fill(cp.X,cp.Y,meuSigMapCor);
07309           }
07310           if (cuts.IsInPittFidVol(cp.X,cp.Y,cp.Z,u,v)) {
07311             pYvsXPitt100->Fill(cp.X,cp.Y,meuSigMapCor);
07312           }
07313           
07314           hYvsX200->Fill(cp.X,cp.Y);
07315           pYvsX200->Fill(cp.X,cp.Y,meuSigMapCor);
07316 
07317           if (cp.View==2){
07318             
07319             //16 bins
07320             hYvsX16U->Fill(cp.X,cp.Y);
07321             //pYvsX16U->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07322             //pYvsX16U1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07323             //pYvsX16U2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07324             pYvsX16U->Fill(cp.X,cp.Y,meuSigMapCor);
07325             pYvsX16U1->Fill(cp.X,cp.Y,meuSigMapCor1);
07326             pYvsX16U2->Fill(cp.X,cp.Y,meuSigMapCor2);
07327             pStsYvsX16U->Fill(cp.X,cp.Y,meuSigCorCor);
07328             pStsYvsX16U1->Fill(cp.X,cp.Y,meuSigCorCor1);
07329             pStsYvsX16U2->Fill(cp.X,cp.Y,meuSigCorCor2);
07330             pStsYvsX16U1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07331             pStsYvsX16U2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07332             pAdcYvsX16U->Fill(cp.X,cp.Y,meuAdcCor);
07333             pAdcYvsX16U1->Fill(cp.X,cp.Y,meuAdcCor1);
07334             pAdcYvsX16U2->Fill(cp.X,cp.Y,meuAdcCor2);
07335             pPeYvsX16U->Fill(cp.X,cp.Y,meuSigPeCor);
07336             pPeYvsX16U1->Fill(cp.X,cp.Y,meuSigPeCor1);
07337             pPeYvsX16U2->Fill(cp.X,cp.Y,meuSigPeCor2);
07338 
07339             //30 bins
07340             hYvsX30U->Fill(cp.X,cp.Y);
07341             //pYvsX30U->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07342             //pYvsX30U1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07343             //pYvsX30U2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07344             pYvsX30U->Fill(cp.X,cp.Y,meuSigMapCor);
07345             pYvsX30U1->Fill(cp.X,cp.Y,meuSigMapCor1);
07346             pYvsX30U2->Fill(cp.X,cp.Y,meuSigMapCor2);
07347             pStsYvsX30U->Fill(cp.X,cp.Y,meuSigCorCor);
07348             pStsYvsX30U1->Fill(cp.X,cp.Y,meuSigCorCor1);
07349             pStsYvsX30U2->Fill(cp.X,cp.Y,meuSigCorCor2);
07350             pStsYvsX30U1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07351             pStsYvsX30U2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07352             pAdcYvsX30U->Fill(cp.X,cp.Y,meuAdcCor);
07353             pAdcYvsX30U1->Fill(cp.X,cp.Y,meuAdcCor1);
07354             pAdcYvsX30U2->Fill(cp.X,cp.Y,meuAdcCor2);
07355             pPeYvsX30U->Fill(cp.X,cp.Y,meuSigPeCor);
07356             pPeYvsX30U1->Fill(cp.X,cp.Y,meuSigPeCor1);
07357             pPeYvsX30U2->Fill(cp.X,cp.Y,meuSigPeCor2);
07358 
07359             //60 bins
07360             hYvsXU->Fill(cp.X,cp.Y);
07361             //pYvsXU->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07362             //pYvsXU1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07363             //pYvsXU2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07364             pYvsXU->Fill(cp.X,cp.Y,meuSigMapCor);
07365             pYvsXU1->Fill(cp.X,cp.Y,meuSigMapCor1);
07366             pYvsXU2->Fill(cp.X,cp.Y,meuSigMapCor2);
07367             pStsYvsXU->Fill(cp.X,cp.Y,meuSigCorCor);
07368             pStsYvsXU1->Fill(cp.X,cp.Y,meuSigCorCor1);
07369             pStsYvsXU2->Fill(cp.X,cp.Y,meuSigCorCor2);
07370             pStsYvsXU1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07371             pStsYvsXU2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07372             pAdcYvsXU->Fill(cp.X,cp.Y,meuAdcCor);
07373             pAdcYvsXU1->Fill(cp.X,cp.Y,meuAdcCor1);
07374             pAdcYvsXU2->Fill(cp.X,cp.Y,meuAdcCor2);
07375             pPeYvsXU->Fill(cp.X,cp.Y,meuSigPeCor);
07376             pPeYvsXU1->Fill(cp.X,cp.Y,meuSigPeCor1);
07377             pPeYvsXU2->Fill(cp.X,cp.Y,meuSigPeCor2);
07378 
07379             //FULL planes, 60 bins
07380             if ((pl-1)%5==0) {
07381               hYvsXFU->Fill(cp.X,cp.Y);
07382               //pYvsXFU->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07383               //pYvsXFU1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07384               //pYvsXFU2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07385               pYvsXFU->Fill(cp.X,cp.Y,meuSigMapCor);
07386               pYvsXFU1->Fill(cp.X,cp.Y,meuSigMapCor1);
07387               pYvsXFU2->Fill(cp.X,cp.Y,meuSigMapCor2);
07388               pStsYvsXFU->Fill(cp.X,cp.Y,meuSigCorCor);
07389               pStsYvsXFU1->Fill(cp.X,cp.Y,meuSigCorCor1);
07390               pStsYvsXFU2->Fill(cp.X,cp.Y,meuSigCorCor2);
07391               pStsYvsXFU1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07392               pStsYvsXFU2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07393               pAdcYvsXFU->Fill(cp.X,cp.Y,meuAdcCor);
07394               pAdcYvsXFU1->Fill(cp.X,cp.Y,meuAdcCor1);
07395               pAdcYvsXFU2->Fill(cp.X,cp.Y,meuAdcCor2);
07396             }
07397             //PARTIAL planes, 60 bins
07398             else {
07399               hYvsXPU->Fill(cp.X,cp.Y);
07400               //pYvsXPU->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07401               //pYvsXPU1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07402               //pYvsXPU2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07403               pYvsXPU->Fill(cp.X,cp.Y,meuSigMapCor);
07404               pYvsXPU1->Fill(cp.X,cp.Y,meuSigMapCor1);
07405               pYvsXPU2->Fill(cp.X,cp.Y,meuSigMapCor2);
07406               pStsYvsXPU->Fill(cp.X,cp.Y,meuSigCorCor);
07407               pStsYvsXPU1->Fill(cp.X,cp.Y,meuSigCorCor1);
07408               pStsYvsXPU2->Fill(cp.X,cp.Y,meuSigCorCor2);
07409               pStsYvsXPU1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07410               pStsYvsXPU2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07411               pAdcYvsXPU->Fill(cp.X,cp.Y,meuAdcCor);
07412               pAdcYvsXPU1->Fill(cp.X,cp.Y,meuAdcCor1);
07413               pAdcYvsXPU2->Fill(cp.X,cp.Y,meuAdcCor2);
07414             }
07415 
07416             //100 bins
07417             hYvsX100U->Fill(cp.X,cp.Y);
07418             //pYvsX100U->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07419             //pYvsX100U1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07420             //pYvsX100U2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07421             pYvsX100U->Fill(cp.X,cp.Y,meuSigMapCor);
07422             pYvsX100U1->Fill(cp.X,cp.Y,meuSigMapCor1);
07423             pYvsX100U2->Fill(cp.X,cp.Y,meuSigMapCor2);
07424             pStsYvsX100U->Fill(cp.X,cp.Y,meuSigCorCor);
07425             pStsYvsX100U1->Fill(cp.X,cp.Y,meuSigCorCor1);
07426             pStsYvsX100U2->Fill(cp.X,cp.Y,meuSigCorCor2);
07427             pStsYvsX100U1Trk->Fill
07428               (cp.X,cp.Y,meuSigCorTrkCor1);
07429             pStsYvsX100U2Trk->Fill
07430               (cp.X,cp.Y,meuSigCorTrkCor2);
07431             pAdcYvsX100U->Fill(cp.X,cp.Y,meuAdcCor);
07432             pAdcYvsX100U1->Fill(cp.X,cp.Y,meuAdcCor1);
07433             pAdcYvsX100U2->Fill(cp.X,cp.Y,meuAdcCor2);
07434             pPeYvsX100U->Fill(cp.X,cp.Y,meuSigPeCor);
07435             pPeYvsX100U1->Fill(cp.X,cp.Y,meuSigPeCor1);
07436             pPeYvsX100U2->Fill(cp.X,cp.Y,meuSigPeCor2);
07437 
07438             //200 bins
07439             hYvsX200U->Fill(cp.X,cp.Y);
07440             //pYvsX200U->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07441             //pYvsX200U1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07442             //pYvsX200U2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07443             pYvsX200U->Fill(cp.X,cp.Y,meuSigMapCor);
07444             pYvsX200U1->Fill(cp.X,cp.Y,meuSigMapCor1);
07445             pYvsX200U2->Fill(cp.X,cp.Y,meuSigMapCor2);
07446             pStsYvsX200U->Fill(cp.X,cp.Y,meuSigCorCor);
07447             pStsYvsX200U1->Fill(cp.X,cp.Y,meuSigCorCor1);
07448             pStsYvsX200U2->Fill(cp.X,cp.Y,meuSigCorCor2);
07449             pStsYvsX200U1Trk->Fill
07450               (cp.X,cp.Y,meuSigCorTrkCor1);
07451             pStsYvsX200U2Trk->Fill
07452               (cp.X,cp.Y,meuSigCorTrkCor2);
07453             pAdcYvsX200U->Fill(cp.X,cp.Y,meuAdcCor);
07454             pAdcYvsX200U1->Fill(cp.X,cp.Y,meuAdcCor1);
07455             pAdcYvsX200U2->Fill(cp.X,cp.Y,meuAdcCor2);
07456             pPeYvsX200U->Fill(cp.X,cp.Y,meuSigPeCor);
07457             pPeYvsX200U1->Fill(cp.X,cp.Y,meuSigPeCor1);
07458             pPeYvsX200U2->Fill(cp.X,cp.Y,meuSigPeCor2);
07459 
07460 
07461             pMeuVsPlU->Fill(pl,meuSigMapCor);
07462             pPeVsPlU->Fill(pl,meuSigPeCor);
07463             pStsVsPlU->Fill(pl,meuSigCorCor);
07464             pSLVsPlU->Fill(pl,meuSigLinCor);
07465             pAdcVsPlU->Fill(pl,meuAdcCor);
07466             
07467             pMeuVsXU->Fill(cp.X,meuSigMapCor);
07468             pMeuVsYU->Fill(cp.Y,meuSigMapCor);
07469             pMeuVsTU->Fill(cp.TPos,meuSigMapCor);
07470             pMeuVsLU->Fill(cp.LPos,meuSigMapCor);
07471             pMeuVsStripU20->Fill(tposStrip,meuSigMapCor);
07472             
07473             pCorVsTU->Fill(cp.TPos,meuSigCorCor);
07474             pCorVsLU->Fill(cp.LPos,meuSigCorCor);
07475 
07476             pAdcVsTU1->Fill(cp.TPos,meuAdcCor1);
07477             pAdcVsTU2->Fill(cp.TPos,meuAdcCor2);
07478 
07479             //high bin ones
07480             pMeuVs40XU->Fill(cp.X,meuSigMapCor);
07481             pMeuVs40YU->Fill(cp.Y,meuSigMapCor);
07482             pMeuVs40TU->Fill(cp.TPos,meuSigMapCor);
07483             pMeuVs40StripU->Fill(tposStrip,meuSigMapCor);
07484             if (tposStrip>=0){
07485               pMeuVsStripU->Fill(tposStrip,meuSigMapCor);
07486               pStsVsStripU->Fill(tposStrip,meuSigCorCor);
07487               pAdcVsStripU->Fill(tposStrip,meuAdcCor);
07488               pPeVsStripU->Fill(tposStrip,meuSigPeCor);
07489               
07490               if ((pl-1)%5==0) {
07491                 pMeuVsStripUF->Fill(tposStrip,meuSigMapCor);
07492                 pStsVsStripUF->Fill(tposStrip,meuSigCorCor);
07493                 pAdcVsStripUF->Fill(tposStrip,meuAdcCor);
07494                 pPeVsStripUF->Fill(tposStrip,meuSigPeCor);
07495               }
07496               else{
07497                 pMeuVsStripUP->Fill(tposStrip,meuSigMapCor);
07498                 pStsVsStripUP->Fill(tposStrip,meuSigCorCor);
07499                 pAdcVsStripUP->Fill(tposStrip,meuAdcCor);
07500                 pPeVsStripUP->Fill(tposStrip,meuSigPeCor);
07501               }
07502             }
07503             pMeuVs40LU->Fill(cp.LPos,meuSigMapCor);
07504             
07505             pCorVs40TU->Fill(cp.TPos,meuSigCorCor);
07506             pCorVs40LU->Fill(cp.LPos,meuSigCorCor);
07507 
07508             pAdcVs40TU1->Fill(cp.TPos,meuAdcCor1);
07509             pAdcVs40TU2->Fill(cp.TPos,meuAdcCor2);
07510 
07511             //only fill for hits close to the centre of the strips
07512             if (cp.LPos>-1 && cp.LPos<1){
07513               pMeuVsTU11->Fill(cp.TPos,meuSigMapCor1);
07514               pMeuVsTU21->Fill(cp.TPos,meuSigMapCor2);
07515 
07516               //high bin ones
07517               pMeuVs40TU11->Fill(cp.TPos,meuSigMapCor1);
07518               pMeuVs40TU21->Fill(cp.TPos,meuSigMapCor2);
07519             }
07520             if (cp.LPos>-0.5 && cp.LPos<0.5){
07521               pMeuVsTU15->Fill(cp.TPos,meuSigMapCor1);
07522               pMeuVsTU25->Fill(cp.TPos,meuSigMapCor2);
07523 
07524               //high bin ones
07525               pMeuVs40TU15->Fill(cp.TPos,meuSigMapCor1);
07526               pMeuVs40TU25->Fill(cp.TPos,meuSigMapCor2);
07527             }
07528 
07529             //only fill for 8m long strips for FD
07530             //only fill strips of same given length in ND
07531             //
07532             if ((t.Detector==Detector::kFar && 
07533                  cp.TPos>-1.65 && cp.TPos<1.65) ||
07534                 (t.Detector==Detector::kNear && 
07535                  cp.TPos>-1.65 && cp.TPos<1.65)){
07536               pMeuVsTU8->Fill(cp.TPos,meuSigMapCor);
07537               pMeuVsLU8->Fill(cp.LPos,meuSigMapCor);
07538               pMeuVsLU18->Fill(cp.LPos,meuSigMapCor1);
07539               pMeuVsLU28->Fill(cp.LPos,meuSigMapCor2);
07540 
07541               pCorVsTU8->Fill(cp.TPos,meuSigCorCor);
07542               pCorVsLU8->Fill(cp.LPos,meuSigCorCor);
07543               pCorVsLU18->Fill(cp.LPos,meuSigCorCor1);
07544               pCorVsLU28->Fill(cp.LPos,meuSigCorCor2);
07545 
07546               pAdcVsLU8->Fill(cp.LPos,meuAdcCor);
07547               pAdcVsLU18->Fill(cp.LPos,meuAdcCor1);
07548               pAdcVsLU28->Fill(cp.LPos,meuAdcCor2);
07549 
07550               pPeVsLU8->Fill(cp.LPos,meuSigPeCor);
07551               pPeVsLU18->Fill(cp.LPos,meuSigPeCor1);
07552               pPeVsLU28->Fill(cp.LPos,meuSigPeCor2);
07553 
07554               //high bin ones
07555               pMeuVs40TU8->Fill(cp.TPos,meuSigMapCor);
07556               pMeuVs40LU8->Fill(cp.LPos,meuSigMapCor);
07557               pMeuVs40LU18->Fill(cp.LPos,meuSigMapCor1);
07558               pMeuVs40LU28->Fill(cp.LPos,meuSigMapCor2);
07559 
07560               pCorVs40TU8->Fill(cp.TPos,meuSigCorCor);
07561               pCorVs40LU8->Fill(cp.LPos,meuSigCorCor);
07562               pCorVs40LU18->Fill(cp.LPos,meuSigCorCor1);
07563               pCorVs40LU28->Fill(cp.LPos,meuSigCorCor2);
07564 
07565               pAdcVs40LU8->Fill(cp.LPos,meuAdcCor);
07566               pAdcVs40LU18->Fill(cp.LPos,meuAdcCor1);
07567               pAdcVs40LU28->Fill(cp.LPos,meuAdcCor2);
07568 
07569               pPeVs40LU8->Fill(cp.LPos,meuSigPeCor);
07570               pPeVs40LU18->Fill(cp.LPos,meuSigPeCor1);
07571               pPeVs40LU28->Fill(cp.LPos,meuSigPeCor2);
07572             }
07573           }
07574           else if (cp.View==3){
07575 
07576             //16 bins
07577             hYvsX16V->Fill(cp.X,cp.Y);
07578             //pYvsX16V->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07579             //pYvsX16V1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07580             //pYvsX16V2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07581             pYvsX16V->Fill(cp.X,cp.Y,meuSigMapCor);
07582             pYvsX16V1->Fill(cp.X,cp.Y,meuSigMapCor1);
07583             pYvsX16V2->Fill(cp.X,cp.Y,meuSigMapCor2);
07584             pStsYvsX16V->Fill(cp.X,cp.Y,meuSigCorCor);
07585             pStsYvsX16V1->Fill(cp.X,cp.Y,meuSigCorCor1);
07586             pStsYvsX16V2->Fill(cp.X,cp.Y,meuSigCorCor2);
07587             pStsYvsX16V1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07588             pStsYvsX16V2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07589             pAdcYvsX16V->Fill(cp.X,cp.Y,meuAdcCor);
07590             pAdcYvsX16V1->Fill(cp.X,cp.Y,meuAdcCor1);
07591             pAdcYvsX16V2->Fill(cp.X,cp.Y,meuAdcCor2);
07592             pPeYvsX16V->Fill(cp.X,cp.Y,meuSigPeCor);
07593             pPeYvsX16V1->Fill(cp.X,cp.Y,meuSigPeCor1);
07594             pPeYvsX16V2->Fill(cp.X,cp.Y,meuSigPeCor2);
07595 
07596             //30 bins
07597             hYvsX30V->Fill(cp.X,cp.Y);
07598             //pYvsX30V->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07599             //pYvsX30V1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07600             //pYvsX30V2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07601             pYvsX30V->Fill(cp.X,cp.Y,meuSigMapCor);
07602             pYvsX30V1->Fill(cp.X,cp.Y,meuSigMapCor1);
07603             pYvsX30V2->Fill(cp.X,cp.Y,meuSigMapCor2);
07604             pStsYvsX30V->Fill(cp.X,cp.Y,meuSigCorCor);
07605             pStsYvsX30V1->Fill(cp.X,cp.Y,meuSigCorCor1);
07606             pStsYvsX30V2->Fill(cp.X,cp.Y,meuSigCorCor2);
07607             pStsYvsX30V1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07608             pStsYvsX30V2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07609             pAdcYvsX30V->Fill(cp.X,cp.Y,meuAdcCor);
07610             pAdcYvsX30V1->Fill(cp.X,cp.Y,meuAdcCor1);
07611             pAdcYvsX30V2->Fill(cp.X,cp.Y,meuAdcCor2);
07612             pPeYvsX30V->Fill(cp.X,cp.Y,meuSigPeCor);
07613             pPeYvsX30V1->Fill(cp.X,cp.Y,meuSigPeCor1);
07614             pPeYvsX30V2->Fill(cp.X,cp.Y,meuSigPeCor2);
07615 
07616             //60 bins
07617             hYvsXV->Fill(cp.X,cp.Y);
07618             //pYvsXV->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07619             //pYvsXV1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07620             //pYvsXV2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07621             pYvsXV->Fill(cp.X,cp.Y,meuSigMapCor);
07622             pYvsXV1->Fill(cp.X,cp.Y,meuSigMapCor1);
07623             pYvsXV2->Fill(cp.X,cp.Y,meuSigMapCor2);
07624             pStsYvsXV->Fill(cp.X,cp.Y,meuSigCorCor);
07625             pStsYvsXV1->Fill(cp.X,cp.Y,meuSigCorCor1);
07626             pStsYvsXV2->Fill(cp.X,cp.Y,meuSigCorCor2);
07627             pStsYvsXV1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07628             pStsYvsXV2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07629             pAdcYvsXV->Fill(cp.X,cp.Y,meuAdcCor);
07630             pAdcYvsXV1->Fill(cp.X,cp.Y,meuAdcCor1);
07631             pAdcYvsXV2->Fill(cp.X,cp.Y,meuAdcCor2);
07632             pPeYvsXV->Fill(cp.X,cp.Y,meuSigPeCor);
07633             pPeYvsXV1->Fill(cp.X,cp.Y,meuSigPeCor1);
07634             pPeYvsXV2->Fill(cp.X,cp.Y,meuSigPeCor2);
07635 
07636             //FULL planes, 60 bins
07637             if ((pl-1)%5==0) {
07638               hYvsXFV->Fill(cp.X,cp.Y);
07639               //pYvsXFV->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07640               //pYvsXFV1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07641               //pYvsXFV2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07642               pYvsXFV->Fill(cp.X,cp.Y,meuSigMapCor);
07643               pYvsXFV1->Fill(cp.X,cp.Y,meuSigMapCor1);
07644               pYvsXFV2->Fill(cp.X,cp.Y,meuSigMapCor2);
07645               pStsYvsXFV->Fill(cp.X,cp.Y,meuSigCorCor);
07646               pStsYvsXFV1->Fill(cp.X,cp.Y,meuSigCorCor1);
07647               pStsYvsXFV2->Fill(cp.X,cp.Y,meuSigCorCor2);
07648               pStsYvsXFV1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07649               pStsYvsXFV2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07650               pAdcYvsXFV->Fill(cp.X,cp.Y,meuAdcCor);
07651               pAdcYvsXFV1->Fill(cp.X,cp.Y,meuAdcCor1);
07652               pAdcYvsXFV2->Fill(cp.X,cp.Y,meuAdcCor2);
07653             }
07654             //PARTIAL planes, 60 bins
07655             else {
07656               hYvsXPV->Fill(cp.X,cp.Y);
07657               //pYvsXPV->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07658               //pYvsXPV1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07659               //pYvsXPV2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07660               pYvsXPV->Fill(cp.X,cp.Y,meuSigMapCor);
07661               pYvsXPV1->Fill(cp.X,cp.Y,meuSigMapCor1);
07662               pYvsXPV2->Fill(cp.X,cp.Y,meuSigMapCor2);
07663               pStsYvsXPV->Fill(cp.X,cp.Y,meuSigCorCor);
07664               pStsYvsXPV1->Fill(cp.X,cp.Y,meuSigCorCor1);
07665               pStsYvsXPV2->Fill(cp.X,cp.Y,meuSigCorCor2);
07666               pStsYvsXPV1Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor1);
07667               pStsYvsXPV2Trk->Fill(cp.X,cp.Y,meuSigCorTrkCor2);
07668               pAdcYvsXPV->Fill(cp.X,cp.Y,meuAdcCor);
07669               pAdcYvsXPV1->Fill(cp.X,cp.Y,meuAdcCor1);
07670               pAdcYvsXPV2->Fill(cp.X,cp.Y,meuAdcCor2);
07671             }
07672 
07673             //100 bins 
07674             hYvsX100V->Fill(cp.X,cp.Y);
07675             //pYvsX100V->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07676             //pYvsX100V1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07677             //pYvsX100V2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07678             pYvsX100V->Fill(cp.X,cp.Y,meuSigMapCor);
07679             pYvsX100V1->Fill(cp.X,cp.Y,meuSigMapCor1);
07680             pYvsX100V2->Fill(cp.X,cp.Y,meuSigMapCor2);
07681             pStsYvsX100V->Fill(cp.X,cp.Y,meuSigCorCor);
07682             pStsYvsX100V1->Fill(cp.X,cp.Y,meuSigCorCor1);
07683             pStsYvsX100V2->Fill(cp.X,cp.Y,meuSigCorCor2);
07684             pStsYvsX100V1Trk->Fill
07685               (cp.X,cp.Y,meuSigCorTrkCor1);
07686             pStsYvsX100V2Trk->Fill
07687               (cp.X,cp.Y,meuSigCorTrkCor2);
07688             pAdcYvsX100V->Fill(cp.X,cp.Y,meuAdcCor);
07689             pAdcYvsX100V1->Fill(cp.X,cp.Y,meuAdcCor1);
07690             pAdcYvsX100V2->Fill(cp.X,cp.Y,meuAdcCor2);
07691             pPeYvsX100V->Fill(cp.X,cp.Y,meuSigPeCor);
07692             pPeYvsX100V1->Fill(cp.X,cp.Y,meuSigPeCor1);
07693             pPeYvsX100V2->Fill(cp.X,cp.Y,meuSigPeCor2);
07694             
07695             //200 bins 
07696             hYvsX200V->Fill(cp.X,cp.Y);
07697             //pYvsX200V->Fill(cp.X,cp.Y,cp.SigMap/cp.PLCor);
07698             //pYvsX200V1->Fill(cp.X,cp.Y,cp.SigMap1/cp.PLCor);
07699             //pYvsX200V2->Fill(cp.X,cp.Y,cp.SigMap2/cp.PLCor);
07700             pYvsX200V->Fill(cp.X,cp.Y,meuSigMapCor);
07701             pYvsX200V1->Fill(cp.X,cp.Y,meuSigMapCor1);
07702             pYvsX200V2->Fill(cp.X,cp.Y,meuSigMapCor2);
07703             pStsYvsX200V->Fill(cp.X,cp.Y,meuSigCorCor);
07704             pStsYvsX200V1->Fill(cp.X,cp.Y,meuSigCorCor1);
07705             pStsYvsX200V2->Fill(cp.X,cp.Y,meuSigCorCor2);
07706             pStsYvsX200V1Trk->Fill
07707               (cp.X,cp.Y,meuSigCorTrkCor1);
07708             pStsYvsX200V2Trk->Fill
07709               (cp.X,cp.Y,meuSigCorTrkCor2);
07710             pAdcYvsX200V->Fill(cp.X,cp.Y,meuAdcCor);
07711             pAdcYvsX200V1->Fill(cp.X,cp.Y,meuAdcCor1);
07712             pAdcYvsX200V2->Fill(cp.X,cp.Y,meuAdcCor2);
07713             pPeYvsX200V->Fill(cp.X,cp.Y,meuSigPeCor);
07714             pPeYvsX200V1->Fill(cp.X,cp.Y,meuSigPeCor1);
07715             pPeYvsX200V2->Fill(cp.X,cp.Y,meuSigPeCor2);
07716 
07717             //with plane            
07718             pMeuVsPlV->Fill(pl,meuSigMapCor);
07719             pPeVsPlV->Fill(pl,meuSigPeCor);
07720             pStsVsPlV->Fill(pl,meuSigCorCor);
07721             pSLVsPlV->Fill(pl,meuSigLinCor);
07722             pAdcVsPlV->Fill(pl,meuAdcCor);
07723 
07724             pMeuVsXV->Fill(cp.X,meuSigMapCor);
07725             pMeuVsYV->Fill(cp.Y,meuSigMapCor);
07726             pMeuVsTV->Fill(cp.TPos,meuSigMapCor);
07727             pMeuVsStripV20->Fill(tposStrip,meuSigMapCor);
07728             pMeuVsLV->Fill(cp.LPos,meuSigMapCor);
07729 
07730             pCorVsTV->Fill(cp.TPos,meuSigCorCor);
07731             pCorVsLV->Fill(cp.LPos,meuSigCorCor);
07732 
07733             pAdcVsTV1->Fill(cp.TPos,meuAdcCor1);
07734             pAdcVsTV2->Fill(cp.TPos,meuAdcCor2);
07735 
07736             //high bin ones
07737             pMeuVs40XV->Fill(cp.X,meuSigMapCor);
07738             pMeuVs40YV->Fill(cp.Y,meuSigMapCor);
07739             pMeuVs40TV->Fill(cp.TPos,meuSigMapCor);
07740             pMeuVs40StripV->Fill(tposStrip,meuSigMapCor);
07741             if (tposStrip>=0){
07742               pMeuVsStripV->Fill(tposStrip,meuSigMapCor);
07743               pStsVsStripV->Fill(tposStrip,meuSigCorCor);
07744               pAdcVsStripV->Fill(tposStrip,meuAdcCor);
07745               pPeVsStripV->Fill(tposStrip,meuSigPeCor);
07746 
07747               if ((pl-1)%5==0) {
07748                 pMeuVsStripVF->Fill(tposStrip,meuSigMapCor);
07749                 pStsVsStripVF->Fill(tposStrip,meuSigCorCor);
07750                 pAdcVsStripVF->Fill(tposStrip,meuAdcCor);
07751                 pPeVsStripVF->Fill(tposStrip,meuSigPeCor);
07752               }
07753               else{
07754                 pMeuVsStripVP->Fill(tposStrip,meuSigMapCor);
07755                 pStsVsStripVP->Fill(tposStrip,meuSigCorCor);
07756                 pAdcVsStripVP->Fill(tposStrip,meuAdcCor);
07757                 pPeVsStripVP->Fill(tposStrip,meuSigPeCor);
07758               }
07759             }
07760             pMeuVs40LV->Fill(cp.LPos,meuSigMapCor);
07761 
07762             pCorVs40TV->Fill(cp.TPos,meuSigCorCor);
07763             pCorVs40LV->Fill(cp.LPos,meuSigCorCor);
07764 
07765             pAdcVs40TV1->Fill(cp.TPos,meuAdcCor1);
07766             pAdcVs40TV2->Fill(cp.TPos,meuAdcCor2);
07767 
07768 
07769             //only fill for hits close to the centre of the strips
07770             if (cp.LPos>-1 && cp.LPos<1){
07771               pMeuVsTV11->Fill(cp.TPos,meuSigMapCor1);
07772               pMeuVsTV21->Fill(cp.TPos,meuSigMapCor2);
07773 
07774               //high bin ones
07775               pMeuVs40TV11->Fill(cp.TPos,meuSigMapCor1);
07776               pMeuVs40TV21->Fill(cp.TPos,meuSigMapCor2);
07777             }
07778             if (cp.LPos>-0.5 && cp.LPos<0.5){
07779               pMeuVsTV15->Fill(cp.TPos,meuSigMapCor1);
07780               pMeuVsTV25->Fill(cp.TPos,meuSigMapCor2);
07781 
07782               //high bin ones
07783               pMeuVs40TV15->Fill(cp.TPos,meuSigMapCor1);
07784               pMeuVs40TV25->Fill(cp.TPos,meuSigMapCor2);
07785             }
07786 
07787             //only fill for 8m long strips for FD
07788             //only fill strips of same given length in ND
07789             if ((t.Detector==Detector::kFar && 
07790                  cp.TPos>-1.65 && cp.TPos<1.65) ||
07791                 (t.Detector==Detector::kNear && 
07792                  cp.TPos>-1.65 && cp.TPos<1.65)){
07793               pMeuVsTV8->Fill(cp.TPos,meuSigMapCor);
07794               pMeuVsLV8->Fill(cp.LPos,meuSigMapCor);
07795               pMeuVsLV18->Fill(cp.LPos,meuSigMapCor1);
07796               pMeuVsLV28->Fill(cp.LPos,meuSigMapCor2);
07797 
07798               pCorVsTV8->Fill(cp.TPos,meuSigCorCor);
07799               pCorVsLV8->Fill(cp.LPos,meuSigCorCor);
07800               pCorVsLV18->Fill(cp.LPos,meuSigCorCor1);
07801               pCorVsLV28->Fill(cp.LPos,meuSigCorCor2);
07802               
07803               pAdcVsLV8->Fill(cp.LPos,meuAdcCor);
07804               pAdcVsLV18->Fill(cp.LPos,meuAdcCor1);
07805               pAdcVsLV28->Fill(cp.LPos,meuAdcCor2);
07806 
07807               pPeVsLV8->Fill(cp.LPos,meuSigPeCor);
07808               pPeVsLV18->Fill(cp.LPos,meuSigPeCor1);
07809               pPeVsLV28->Fill(cp.LPos,meuSigPeCor2);
07810 
07811               //high bin ones
07812               pMeuVs40TV8->Fill(cp.TPos,meuSigMapCor);
07813               pMeuVs40LV8->Fill(cp.LPos,meuSigMapCor);
07814               pMeuVs40LV18->Fill(cp.LPos,meuSigMapCor1);
07815               pMeuVs40LV28->Fill(cp.LPos,meuSigMapCor2);
07816 
07817               pCorVs40TV8->Fill(cp.TPos,meuSigCorCor);
07818               pCorVs40LV8->Fill(cp.LPos,meuSigCorCor);
07819               pCorVs40LV18->Fill(cp.LPos,meuSigCorCor1);
07820               pCorVs40LV28->Fill(cp.LPos,meuSigCorCor2);
07821               
07822               pAdcVs40LV8->Fill(cp.LPos,meuAdcCor);
07823               pAdcVs40LV18->Fill(cp.LPos,meuAdcCor1);
07824               pAdcVs40LV28->Fill(cp.LPos,meuAdcCor2);
07825               pPeVs40LV8->Fill(cp.LPos,meuSigPeCor);
07826               pPeVs40LV18->Fill(cp.LPos,meuSigPeCor1);
07827               pPeVs40LV28->Fill(cp.LPos,meuSigPeCor2);
07828             }
07829           }
07830         }
07831       }
07832     }//end of loop over meuHits
07833 
07834     //calc GeV per MEU
07835     GeVPerMeu/=planeCounter;
07836     meuPeRaw/=planeCounter;
07837     hGeVPerMeu->Fill(GeVPerMeu);
07838     hPeRaw->Fill(meuPeRaw);
07839     if (meuWinCorCounter!=0){
07840       meuWinCor/=meuWinCorCounter;
07841       sigDrfWin/=meuWinCorCounter;
07842       sigLinOnlyWin/=meuWinCorCounter;
07843       if (fabs(t.WinAvCosThetaZ)>0.3) {
07844         hSigMapWinCor->Fill(meuWinCor);
07845         hSigDrfWin->Fill(sigDrfWin);
07846         hSigLinOnlyWin->Fill(sigLinOnlyWin);
07847 
07848         //these two should be above but earlier versions 
07849         //of MeuSummary (before 09/May/07) did not have WinSigLinOnly
07850         vWinSigLinOnlyCosTh.push_back(sigLinOnlyWin);
07851         vWinSigDrfCosTh.push_back(sigDrfWin);
07852       }
07853     }
07854 
07855     //calculate individual stripend and SM MEUs
07856     if (uCounter>0){
07857       meuU1/=uCounter;
07858       meuU2/=uCounter;
07859 
07860       if (t.SM1) {
07861         meuSM1U1/=uCounter;
07862         meuSM1U2/=uCounter;
07863       }
07864       else if (t.SM2) {
07865         meuSM2U1/=uCounter;
07866         meuSM2U2/=uCounter;
07867       }
07868     }
07869     if (vCounter>0){
07870       meuV1/=vCounter;
07871       meuV2/=vCounter;
07872 
07873       if (t.SM1) {
07874         meuSM1V1/=vCounter;
07875         meuSM1V2/=vCounter;
07876       }
07877       else if (t.SM2) {
07878         meuSM2V1/=vCounter;
07879         meuSM2V2/=vCounter;
07880       }
07881     }
07882 
07883     //fill the meu for four separate stripends
07884     hSigMapU1->Fill(meuU1);
07885     hSigMapU2->Fill(meuU2);
07886     hSigMapV1->Fill(meuV1);
07887     hSigMapV2->Fill(meuV2);
07888 
07889     if (t.SM1) {
07890       hSigMapSM1U1->Fill(meuSM1U1);
07891       hSigMapSM1U2->Fill(meuSM1U2);
07892       hSigMapSM1V1->Fill(meuSM1V1);
07893       hSigMapSM1V2->Fill(meuSM1V2);
07894     }
07895     else if (t.SM2) {
07896       hSigMapSM2U1->Fill(meuSM2U1);
07897       hSigMapSM2U2->Fill(meuSM2U2);
07898       hSigMapSM2V1->Fill(meuSM2V1);
07899       hSigMapSM2V2->Fill(meuSM2V2);
07900     }
07901     else cout<<"Ahhhhhhhhhh"<<endl;
07902   }
07903 
07907 
07908   MSG("MeuPlots",Msg::kInfo)<<"Finished main loop"<<endl;
07909 
07910   Int_t det=static_cast<Int_t>(hDetector->GetMean());
07911   Int_t simFlag=static_cast<Int_t>(hSimFlag->GetMean());
07912   MAXMSG("MeuPlots",Msg::kInfo,100)
07913     <<"Using Detector="<<det<<", SimFlag="<<simFlag<<endl;
07914   
07915   Int_t numMonths=static_cast<Int_t>
07916     ((endTimeSecs-startTimeSecs)/(30*24*60*60))+1;
07917   MSG("MeuPlots",Msg::kInfo)
07918     <<"Found start time and end time: "
07919     <<startTimeSecs<<" -> "<<endTimeSecs
07920     <<", #months="<<numMonths<<endl;
07921   this->EpochTo1995(endTimeSecs);
07922   this->EpochTo1995(startTimeSecs);
07923   
07924   for (Int_t i=0;i<20;i++){
07925     Double_t quantile=0.5;//quantile to compute
07926     Double_t meu=-1;
07927     Float_t cosTheta=(i/10.)-1;
07928     TH1F* h=meuCosTh[i];
07929     h->GetQuantiles(1,&meu,&quantile);
07930     MSG("MeuPlots",Msg::kInfo)
07931       <<"CosTheta="<<cosTheta
07932       <<", meu="<<meu
07933       <<", mean="<<h->GetMean()
07934       <<", entries="<<h->GetEntries()
07935       <<endl;
07936   }
07937 
07938 // CosTheta=-1, meu=564.5, mean=571.756, entries=604
07939 // CosTheta=-0.9, meu=565.5, mean=573.711, entries=1372
07940 // CosTheta=-0.8, meu=565, mean=576.997, entries=2142
07941 // CosTheta=-0.7, meu=563.523, mean=575.938, entries=3029
07942 // CosTheta=-0.6, meu=564.86, mean=575.868, entries=3439
07943 // CosTheta=-0.5, meu=565.933, mean=578.496, entries=3862
07944 // CosTheta=-0.4, meu=571.75, mean=585.781, entries=2550
07945 // CosTheta=-0.3, meu=582.417, mean=603.249, entries=1181
07946 // CosTheta=-0.2, meu=590.5, mean=611.152, entries=157
07947 // Error in <TH1F::ComputeIntegral>: Integral = zero
07948 // Error in <TH1F::ComputeIntegral>: Integral = zero
07949 // CosTheta=-0.1, meu=4999, mean=0, entries=0
07950 // Error in <TH1F::ComputeIntegral>: Integral = zero
07951 // Error in <TH1F::ComputeIntegral>: Integral = zero
07952 // CosTheta=0, meu=4999, mean=0, entries=0
07953 // CosTheta=0.1, meu=600.5, mean=634.526, entries=157
07954 // CosTheta=0.2, meu=590.1, mean=610.087, entries=1386
07955 // CosTheta=0.3, meu=570.231, mean=585.011, entries=2826
07956 // CosTheta=0.4, meu=564.479, mean=580.238, entries=4556
07957 // CosTheta=0.5, meu=565.95, mean=580.656, entries=4220
07958 // CosTheta=0.6, meu=563.188, mean=574.426, entries=3774
07959 // CosTheta=0.7, meu=565.333, mean=576.595, entries=2794
07960 // CosTheta=0.8, meu=563.8, mean=573.431, entries=1866
07961 // CosTheta=0.9, meu=564.357, mean=570.959, entries=885
07962 
07963   Double_t quantile=0.5;//quantile to compute
07964   Double_t meu=-1;
07965   hSigMap->GetQuantiles(1,&meu,&quantile);
07966   for (Double_t q=0.4;q<=0.6;q+=0.01){
07967     Double_t sigMap=0;
07968     hSigMap->GetQuantiles(1,&sigMap,&q);
07969     
07970     MSG("MeuPlots",Msg::kInfo)
07971       <<"meu="<<sigMap<<" for quantile="<<q
07972       <<", diff="<<sigMap-meu<<" ("<<100.*(sigMap-meu)/meu<<"%)"
07973       <<endl;
07974   }
07975   MSG("MeuPlots",Msg::kInfo)
07976     <<endl<<"meu="<<meu<<", mean="<<hSigMap->GetMean()
07977     <<", entries="<<hSigMap->GetEntries()<<endl<<endl;
07978 
07979   Double_t meuForward=-1;
07980   hSigMapForw->GetQuantiles(1,&meuForward,&quantile);
07981   Double_t meuBackward=-1;
07982   hSigMapBack->GetQuantiles(1,&meuBackward,&quantile);
07983   MSG("MeuPlots",Msg::kInfo)
07984     <<endl<<"Forwards and backwards:"<<endl
07985     <<"  forward  meu="<<meuForward<<", mean="<<hSigMapForw->GetMean()
07986     <<", entries="<<hSigMapForw->GetEntries()<<endl;
07987   MSG("MeuPlots",Msg::kInfo)
07988     <<"  backward meu="<<meuBackward<<", mean="<<hSigMapBack->GetMean()
07989     <<", entries="<<hSigMapBack->GetEntries()<<endl;
07990   
07991   Double_t meuSM1=-1;
07992   hSigMapSM1->GetQuantiles(1,&meuSM1,&quantile);
07993   Double_t meuSM2=-1;
07994   hSigMapSM2->GetQuantiles(1,&meuSM2,&quantile);
07995   MSG("MeuPlots",Msg::kInfo)
07996     <<endl<<"SM1 and SM2:"<<endl
07997     <<"  SM1:  meu="<<meuSM1<<", mean="<<hSigMapSM1->GetMean()
07998     <<", entries="<<hSigMapSM1->GetEntries()<<endl;
07999   MSG("MeuPlots",Msg::kInfo)
08000     <<"  SM2:  meu="<<meuSM2<<", mean="<<hSigMapSM2->GetMean()
08001     <<", entries="<<hSigMapSM2->GetEntries()<<endl;
08002   
08003   Double_t meuU1=-1;
08004   Double_t meuU2=-1;
08005   Double_t meuV1=-1;
08006   Double_t meuV2=-1;
08007   hSigMapU1->GetQuantiles(1,&meuU1,&quantile);
08008   hSigMapU2->GetQuantiles(1,&meuU2,&quantile);
08009   hSigMapV1->GetQuantiles(1,&meuV1,&quantile);
08010   hSigMapV2->GetQuantiles(1,&meuV2,&quantile);
08011   MSG("MeuPlots",Msg::kInfo)
08012     <<endl<<"Individual stripends:"<<endl
08013     <<"    meuU1="<<meuU1<<", mean="<<hSigMapU1->GetMean()
08014     <<", entries="<<hSigMapU1->GetEntries()<<endl
08015     <<"    meuU2="<<meuU2<<", mean="<<hSigMapU2->GetMean()
08016     <<", entries="<<hSigMapU2->GetEntries()<<endl
08017     <<"    meuV1="<<meuV1<<", mean="<<hSigMapV1->GetMean()
08018     <<", entries="<<hSigMapV1->GetEntries()<<endl
08019     <<"    meuV2="<<meuV2<<", mean="<<hSigMapV2->GetMean()
08020     <<", entries="<<hSigMapV2->GetEntries()<<endl;
08021 
08022   Double_t GeVPerMeu=-1;
08023   hGeVPerMeu->GetQuantiles(1,&GeVPerMeu,&quantile);
08024   MSG("MeuPlots",Msg::kInfo)
08025     <<endl<<"GeVPerMeu="<<GeVPerMeu<<endl;
08026 
08027   Int_t fudge=0;//31*24*60*60;//1month
08028 
08029   MSG("MeuPlots",Msg::kInfo)<<"Filling vs. Time plots..."<<endl;
08030   TH1F* hEntriesVsTime=new TH1F("hEntriesVsTime","hEntriesVsTime",
08031                                 100,startTimeSecs,endTimeSecs+fudge);
08032   //create an array of 1s to create the occupancy plot
08033   //vector<Double_t> vEntries(vTimeSec.size(),1);
08034   this->TH1FFill(hEntriesVsTime,vTimeSec);
08035   this->SetGraphAxis(hEntriesVsTime->GetXaxis(),
08036                      startTimeSecs,endTimeSecs+fudge);
08037   hEntriesVsTime->GetXaxis()->CenterTitle();
08038   hEntriesVsTime->GetYaxis()->SetTitle("Entries");
08039   hEntriesVsTime->GetYaxis()->CenterTitle();
08040   
08041   TH1F* hEntriesVsTimeMonth=new TH1F
08042     ("hEntriesVsTimeMonth","hEntriesVsTimeMonth",
08043      numMonths,startTimeSecs,endTimeSecs+fudge);
08044   this->TH1FFill(hEntriesVsTimeMonth,vTimeSec);
08045   this->SetGraphAxis(hEntriesVsTimeMonth->GetXaxis(),
08046                      startTimeSecs,endTimeSecs+fudge);
08047   hEntriesVsTimeMonth->GetXaxis()->CenterTitle();
08048   hEntriesVsTimeMonth->GetYaxis()->SetTitle("Entries");
08049   hEntriesVsTimeMonth->GetYaxis()->CenterTitle();
08050   
08051   MSG("MeuPlots",Msg::kInfo)<<"Filling vs. Time plots..."<<endl;
08052   TProfile* pCrateMaskVsTime=new TProfile("pCrateMaskVsTime",
08053                                           "CrateMaskVsTime",
08054                                           100,startTimeSecs,
08055                                           endTimeSecs+fudge);
08056   this->TProfileFill(pCrateMaskVsTime,vTimeSec,vCrateMask);
08057   this->SetGraphAxis(pCrateMaskVsTime->GetXaxis(),
08058                      startTimeSecs,endTimeSecs+fudge);
08059   pCrateMaskVsTime->GetXaxis()->CenterTitle();
08060   pCrateMaskVsTime->GetYaxis()->SetTitle("CrateMask");
08061   pCrateMaskVsTime->GetYaxis()->CenterTitle();
08062 
08063   TProfile* pBusyChipsVsTime=new TProfile("pBusyChipsVsTime",
08064                                           "BusyChipsVsTime",
08065                                           100,startTimeSecs,
08066                                           endTimeSecs+fudge);
08067   this->TProfileFill(pBusyChipsVsTime,vTimeSec,vBusyChips);
08068   this->SetGraphAxis(pBusyChipsVsTime->GetXaxis(),
08069                      startTimeSecs,endTimeSecs+fudge);
08070   pBusyChipsVsTime->GetXaxis()->CenterTitle();
08071   pBusyChipsVsTime->GetYaxis()->SetTitle("BusyChips");
08072   pBusyChipsVsTime->GetYaxis()->CenterTitle();
08073 
08074   TProfile* pColdChipsVsTime=new TProfile("pColdChipsVsTime",
08075                                           "ColdChipsVsTime",
08076                                           100,startTimeSecs,
08077                                           endTimeSecs+fudge);
08078   this->TProfileFill(pColdChipsVsTime,vTimeSec,vColdChips);
08079   this->SetGraphAxis(pColdChipsVsTime->GetXaxis(),
08080                      startTimeSecs,endTimeSecs+fudge);
08081   pColdChipsVsTime->GetXaxis()->CenterTitle();
08082   pColdChipsVsTime->GetYaxis()->SetTitle("ColdChips");
08083   pColdChipsVsTime->GetYaxis()->CenterTitle();
08084 
08085   TProfile* pDataQualityVsTime=new TProfile("pDataQualityVsTime",
08086                                             "DataQualityVsTime",
08087                                             100,startTimeSecs,
08088                                             endTimeSecs+fudge);
08089   this->TProfileFill(pDataQualityVsTime,vTimeSec,vDataQuality);
08090   this->SetGraphAxis(pDataQualityVsTime->GetXaxis(),
08091                      startTimeSecs,endTimeSecs+fudge);
08092   pDataQualityVsTime->GetXaxis()->CenterTitle();
08093   pDataQualityVsTime->GetYaxis()->SetTitle("DataQuality");
08094   pDataQualityVsTime->GetYaxis()->CenterTitle();
08095 
08096   TProfile* pMeuSigMapVsTime=new TProfile("pMeuSigMapVsTime",
08097                                           "pMeuSigMapVsTime",
08098                                           100,startTimeSecs,
08099                                           endTimeSecs+fudge);
08100   this->TProfileFill(pMeuSigMapVsTime,vTimeSec,vWinSigMap);
08101   this->SetGraphAxis(pMeuSigMapVsTime->GetXaxis(),
08102                      startTimeSecs,endTimeSecs+fudge);
08103   pMeuSigMapVsTime->GetXaxis()->CenterTitle();
08104   pMeuSigMapVsTime->GetYaxis()->SetTitle("MEU");
08105   pMeuSigMapVsTime->GetYaxis()->CenterTitle();
08106 
08107   TProfile* pMeuSigMapVsTime50=new TProfile("pMeuSigMapVsTime50",
08108                                             "pMeuSigMapVsTime50",
08109                                             50,startTimeSecs,
08110                                             endTimeSecs+fudge);
08111   this->TProfileFill(pMeuSigMapVsTime50,vTimeSec,vWinSigMap);
08112   this->SetGraphAxis(pMeuSigMapVsTime50->GetXaxis(),
08113                      startTimeSecs,endTimeSecs+fudge);
08114   pMeuSigMapVsTime50->GetXaxis()->CenterTitle();
08115   pMeuSigMapVsTime50->GetYaxis()->SetTitle("MEU");
08116   pMeuSigMapVsTime50->GetYaxis()->CenterTitle();
08117 
08118   TProfile* pMeuSigMapVsTime20=new TProfile("pMeuSigMapVsTime20",
08119                                             "pMeuSigMapVsTime20",
08120                                             20,startTimeSecs,
08121                                             endTimeSecs+fudge);
08122   this->TProfileFill(pMeuSigMapVsTime20,vTimeSec,vWinSigMap);
08123   this->SetGraphAxis(pMeuSigMapVsTime20->GetXaxis(),
08124                      startTimeSecs,endTimeSecs+fudge);
08125   pMeuSigMapVsTime20->GetXaxis()->CenterTitle();
08126   pMeuSigMapVsTime20->GetYaxis()->SetTitle("MEU");
08127   pMeuSigMapVsTime20->GetYaxis()->CenterTitle();
08128 
08129   TProfile* pMeuSigMapVsTime15=new TProfile("pMeuSigMapVsTime15",
08130                                             "pMeuSigMapVsTime15",
08131                                             15,startTimeSecs,
08132                                             endTimeSecs+fudge);
08133   this->TProfileFill(pMeuSigMapVsTime15,vTimeSec,vWinSigMap);
08134   this->SetGraphAxis(pMeuSigMapVsTime15->GetXaxis(),
08135                      startTimeSecs,endTimeSecs+fudge);
08136   pMeuSigMapVsTime15->GetXaxis()->CenterTitle();
08137   pMeuSigMapVsTime15->GetYaxis()->SetTitle("MEU");
08138   pMeuSigMapVsTime15->GetYaxis()->CenterTitle();
08139 
08140   TProfile* pMeuSigMapVsTime10=new TProfile("pMeuSigMapVsTime10",
08141                                             "pMeuSigMapVsTime10",
08142                                             10,startTimeSecs,
08143                                             endTimeSecs+fudge);
08144   this->TProfileFill(pMeuSigMapVsTime10,vTimeSec,vWinSigMap);
08145   this->SetGraphAxis(pMeuSigMapVsTime10->GetXaxis(),
08146                      startTimeSecs,endTimeSecs+fudge);
08147   pMeuSigMapVsTime10->GetXaxis()->CenterTitle();
08148   pMeuSigMapVsTime10->GetYaxis()->SetTitle("MEU");
08149   pMeuSigMapVsTime10->GetYaxis()->CenterTitle();
08150 
08151   TProfile* pMeuSigMapVsTime5=new TProfile("pMeuSigMapVsTime5",
08152                                             "pMeuSigMapVsTime5",
08153                                             5,startTimeSecs,
08154                                             endTimeSecs+fudge);
08155   this->TProfileFill(pMeuSigMapVsTime5,vTimeSec,vWinSigMap);
08156   this->SetGraphAxis(pMeuSigMapVsTime5->GetXaxis(),
08157                      startTimeSecs,endTimeSecs+fudge);
08158   pMeuSigMapVsTime5->GetXaxis()->CenterTitle();
08159   pMeuSigMapVsTime5->GetYaxis()->SetTitle("MEU");
08160   pMeuSigMapVsTime5->GetYaxis()->CenterTitle();
08161 
08162   TProfile* pMeuSigMapVsTime3=new TProfile("pMeuSigMapVsTime3",
08163                                             "pMeuSigMapVsTime3",
08164                                             3,startTimeSecs,
08165                                             endTimeSecs+fudge);
08166   this->TProfileFill(pMeuSigMapVsTime3,vTimeSec,vWinSigMap);
08167   this->SetGraphAxis(pMeuSigMapVsTime3->GetXaxis(),
08168                      startTimeSecs,endTimeSecs+fudge);
08169   pMeuSigMapVsTime3->GetXaxis()->CenterTitle();
08170   pMeuSigMapVsTime3->GetYaxis()->SetTitle("MEU");
08171   pMeuSigMapVsTime3->GetYaxis()->CenterTitle();
08172 
08173 
08174 
08175   //do the drift ones
08176   TProfile* pMeuSigMapDriftVsTime15=new TProfile
08177     ("pMeuSigMapDriftVsTime15","pMeuSigMapDriftVsTime15",
08178      15,startTimeSecs,endTimeSecs+fudge);
08179   this->TProfileFill(pMeuSigMapDriftVsTime15,vTimeSec,vWinSigMapDrift);
08180   this->SetGraphAxis(pMeuSigMapDriftVsTime15->GetXaxis(),
08181                      startTimeSecs,endTimeSecs+fudge);
08182   pMeuSigMapDriftVsTime15->GetXaxis()->CenterTitle();
08183   pMeuSigMapDriftVsTime15->GetYaxis()->SetTitle("MEU");
08184   pMeuSigMapDriftVsTime15->GetYaxis()->CenterTitle();
08185 
08186   TProfile* pMeuSigMapDriftXVsTime15=new TProfile
08187     ("pMeuSigMapDriftXVsTime15","pMeuSigMapDriftXVsTime15",
08188      15,startTimeSecs,endTimeSecs+fudge);
08189   this->TProfileFill(pMeuSigMapDriftXVsTime15,vTimeSec,
08190                      vWinSigMapDriftX);
08191   this->SetGraphAxis(pMeuSigMapDriftXVsTime15->GetXaxis(),
08192                      startTimeSecs,endTimeSecs+fudge);
08193   pMeuSigMapDriftXVsTime15->GetXaxis()->CenterTitle();
08194   pMeuSigMapDriftXVsTime15->GetYaxis()->SetTitle("MEU");
08195   pMeuSigMapDriftXVsTime15->GetYaxis()->CenterTitle();
08196 
08197 
08198   TProfile* pMeuSigMapDriftVsTimeMonth=new TProfile
08199     ("pMeuSigMapDriftVsTimeMonth","pMeuSigMapDriftVsTimeMonth",
08200      numMonths,startTimeSecs,endTimeSecs+fudge);
08201   this->TProfileFill(pMeuSigMapDriftVsTimeMonth,
08202                      vTimeSec,vWinSigMapDrift);
08203   this->SetGraphAxis(pMeuSigMapDriftVsTimeMonth->GetXaxis(),
08204                      startTimeSecs,endTimeSecs+fudge);
08205   pMeuSigMapDriftVsTimeMonth->GetXaxis()->CenterTitle();
08206   pMeuSigMapDriftVsTimeMonth->GetYaxis()->SetTitle("MEU");
08207   pMeuSigMapDriftVsTimeMonth->GetYaxis()->CenterTitle();
08208 
08209   TProfile* pMeuSigMapDriftXVsTimeMonth=new TProfile
08210     ("pMeuSigMapDriftXVsTimeMonth","pMeuSigMapDriftXVsTimeMonth",
08211      numMonths,startTimeSecs,endTimeSecs+fudge);
08212   this->TProfileFill(pMeuSigMapDriftXVsTimeMonth,vTimeSec,
08213                      vWinSigMapDriftX);
08214   this->SetGraphAxis(pMeuSigMapDriftXVsTimeMonth->GetXaxis(),
08215                      startTimeSecs,endTimeSecs+fudge);
08216   pMeuSigMapDriftXVsTimeMonth->GetXaxis()->CenterTitle();
08217   pMeuSigMapDriftXVsTimeMonth->GetYaxis()->SetTitle("MEU");
08218   pMeuSigMapDriftXVsTimeMonth->GetYaxis()->CenterTitle();
08219 
08220   vector<TH1F*> meuDriftStd;
08221   vector<TH1F*> meuDrift;
08222   vector<TH1F*> meuDriftX;
08223   vector<TH1F*> meuDriftCosThStd;
08224   vector<TH1F*> meuDriftCosTh;
08225   vector<TH1F*> meuDriftCosThX;
08226   vector<TH1F*> sigCorDriftCosThStd;
08227   vector<TH1F*> sigLinDriftCosThStd;
08228   vector<TH1F*> adcDriftCosThStd;
08229   vector<TH1F*> peDriftCosThStd;
08230   vector<TH1F*> sigLinOnlyDriftCosThStd;
08231   vector<TH1F*> sigDrfDriftCosThStd;
08232  
08233   for (Int_t i=0;i<numMonths;i++){
08234     string sNameStd="hMeuDriftStdBin";
08235     string sName="hMeuDriftBin";
08236     string sNameX="hMeuDriftXBin";
08237     string sNameCosThStd="hMeuDriftCosThStdBin";
08238     string sNameCosTh="hMeuDriftCosThBin";
08239     string sNameCosThX="hMeuDriftCosThXBin";
08240     string sNameSigCorCosThStd="hSigCorDriftCosThStdBin";
08241     string sNameSigLinCosThStd="hSigLinDriftCosThStdBin";
08242     string sNameAdcCosThStd="hAdcDriftCosThStdBin";
08243     string sNamePeCosThStd="hPeDriftCosThStdBin";
08244     string sNameSigLinOnlyCosThStd="hSigLinOnlyDriftCosThStdBin";
08245     string sNameSigDrfCosThStd="hSigDrfDriftCosThStdBin";
08246     
08247     string sNum=Form("%d",i);
08248     
08249     sNameStd+=sNum;
08250     sName+=sNum;
08251     sNameX+=sNum;
08252     sNameCosThStd+=sNum;
08253     sNameCosTh+=sNum;
08254     sNameCosThX+=sNum;
08255     sNameSigCorCosThStd+=sNum;
08256     sNameSigLinCosThStd+=sNum;
08257     sNameAdcCosThStd+=sNum;
08258     sNamePeCosThStd+=sNum;
08259     sNameSigLinOnlyCosThStd+=sNum;
08260     sNameSigDrfCosThStd+=sNum;
08261 
08262     meuDriftStd.push_back(new TH1F(sNameStd.c_str(),sNameStd.c_str(),
08263                                    20000,0,20000));
08264     meuDrift.push_back(new TH1F(sName.c_str(),sName.c_str(),
08265                                 20000,0,20000));
08266     meuDriftX.push_back(new TH1F(sNameX.c_str(),sNameX.c_str(),
08267                                  20000,0,20000));
08268 
08269     meuDriftCosThStd.push_back(new TH1F(sNameCosThStd.c_str(),
08270                                         sNameCosThStd.c_str(),
08271                                         20000,0,20000));
08272     meuDriftCosTh.push_back(new TH1F(sNameCosTh.c_str(),
08273                                      sNameCosTh.c_str(),
08274                                      20000,0,20000));
08275     meuDriftCosThX.push_back(new TH1F(sNameCosThX.c_str(),
08276                                       sNameCosThX.c_str(),
08277                                       20000,0,20000));
08278 
08279     sigCorDriftCosThStd.push_back(new TH1F(sNameSigCorCosThStd.c_str(),
08280                                            sNameSigCorCosThStd.c_str(),
08281                                            20000,0,20000));
08282     sigLinDriftCosThStd.push_back(new TH1F(sNameSigLinCosThStd.c_str(),
08283                                            sNameSigLinCosThStd.c_str(),
08284                                            20000,0,20000));
08285     adcDriftCosThStd.push_back(new TH1F(sNameAdcCosThStd.c_str(),
08286                                         sNameAdcCosThStd.c_str(),
08287                                         20000,0,20000));
08288     peDriftCosThStd.push_back(new TH1F(sNamePeCosThStd.c_str(),
08289                                        sNamePeCosThStd.c_str(),
08290                                        20000,0,200));
08291     sigLinOnlyDriftCosThStd.push_back
08292       (new TH1F(sNameSigLinOnlyCosThStd.c_str(),
08293                 sNameSigLinOnlyCosThStd.c_str(),
08294                 20000,0,20000));
08295     sigDrfDriftCosThStd.push_back(new TH1F(sNameSigDrfCosThStd.c_str(),
08296                                            sNameSigDrfCosThStd.c_str(),
08297                                            20000,0,20000));
08298   }
08299 
08300   Float_t binSizeDrift=(endTimeSecs-startTimeSecs)/numMonths;
08301   MAXMSG("MeuPlots",Msg::kInfo,100)
08302     <<"binSizeDrift="<<binSizeDrift
08303     <<", numMonths="<<numMonths<<endl;
08304   for (UInt_t i=0;i<vTimeSec.size();i++){
08305     Int_t index=static_cast<Int_t>
08306       ((vTimeSec[i]-startTimeSecs-1)/binSizeDrift);
08307     MAXMSG("MeuPlots",Msg::kInfo,10)
08308       <<"index="<<index
08309       <<", vTimeSec[i]="<<vTimeSec[i]
08310       <<", startTimeSecs="<<startTimeSecs<<endl;
08311     if (index<numMonths){
08312       meuDriftStd[index]->Fill(vWinSigMap[i]);
08313       meuDrift[index]->Fill(vWinSigMapDrift[i]);
08314       meuDriftX[index]->Fill(vWinSigMapDriftX[i]);
08315     }
08316     else cout<<"index="<<index<<endl;
08317   }
08318 
08319   cout<<"Vector size with CosTh cut="<<vTimeSecCosTh.size()<<endl
08320       <<"Vector size with truncation and CosTh cut="
08321       <<vTimeSec.size()<<endl;
08322   for (UInt_t i=0;i<vTimeSecCosTh.size();i++){
08323     Int_t index=static_cast<Int_t>
08324       ((vTimeSecCosTh[i]-startTimeSecs-1)/binSizeDrift);
08325     if (index<numMonths){
08326       meuDriftCosThStd[index]->Fill(vWinSigMapCosTh[i]);
08327       meuDriftCosTh[index]->Fill(vWinSigMapCosThDrift[i]);
08328       meuDriftCosThX[index]->Fill(vWinSigMapCosThDriftX[i]);
08329 
08330       //fill with the other calibration stages
08331       sigCorDriftCosThStd[index]->Fill(vWinSigCorCosTh[i]);
08332       sigLinDriftCosThStd[index]->Fill(vWinSigLinCosTh[i]);
08333       adcDriftCosThStd[index]->Fill(vWinAdcCosTh[i]);
08334       peDriftCosThStd[index]->Fill(vWinPeCosTh[i]);
08335       sigLinOnlyDriftCosThStd[index]->Fill(vWinSigLinOnlyCosTh[i]);
08336       sigDrfDriftCosThStd[index]->Fill(vWinSigDrfCosTh[i]);
08337     }
08338     else cout<<"index="<<index<<endl;
08339   }
08340 
08341 
08342   TH1F* hMeuDriftN=new TH1F("hMeuDriftN","hMeuDriftN",
08343                            numMonths,startTimeSecs,endTimeSecs+fudge);
08344   hMeuDriftN->GetXaxis()->CenterTitle();
08345   hMeuDriftN->GetYaxis()->CenterTitle();
08346   hMeuDriftN->GetYaxis()->SetTitle("Entries");
08347   this->SetGraphAxis(hMeuDriftN->GetXaxis(),
08348                      startTimeSecs,endTimeSecs+fudge);
08349 
08350   TH1F* hMeuDriftStd=new TH1F("hMeuDriftStd","hMeuDriftStd",
08351                            numMonths,startTimeSecs,endTimeSecs+fudge);
08352   hMeuDriftStd->GetXaxis()->CenterTitle();
08353   hMeuDriftStd->GetYaxis()->CenterTitle();
08354   hMeuDriftStd->GetYaxis()->SetTitle("Meu");
08355   this->SetGraphAxis(hMeuDriftStd->GetXaxis(),
08356                      startTimeSecs,endTimeSecs+fudge);
08357 
08358   TH1F* hMeuDrift=new TH1F("hMeuDrift","hMeuDrift",
08359                            numMonths,startTimeSecs,endTimeSecs+fudge);
08360   hMeuDrift->GetXaxis()->CenterTitle();
08361   hMeuDrift->GetYaxis()->CenterTitle();
08362   hMeuDrift->GetYaxis()->SetTitle("Meu");
08363   this->SetGraphAxis(hMeuDrift->GetXaxis(),
08364                      startTimeSecs,endTimeSecs+fudge);
08365 
08366   TH1F* hMeuDriftX=new TH1F("hMeuDriftX","hMeuDriftX",
08367                            numMonths,startTimeSecs,endTimeSecs+fudge);
08368   hMeuDriftX->GetXaxis()->CenterTitle();
08369   hMeuDriftX->GetYaxis()->CenterTitle();
08370   hMeuDriftX->GetYaxis()->SetTitle("Meu");
08371   this->SetGraphAxis(hMeuDriftX->GetXaxis(),
08372                      startTimeSecs,endTimeSecs+fudge);
08373 
08374 
08375 
08376   TH1F* hMeuDriftCosThStd=new TH1F("hMeuDriftCosThStd",
08377                                    "hMeuDriftCosThStd",
08378                                    numMonths,
08379                                    startTimeSecs,endTimeSecs+fudge);
08380   hMeuDriftCosThStd->GetXaxis()->CenterTitle();
08381   hMeuDriftCosThStd->GetYaxis()->CenterTitle();
08382   hMeuDriftCosThStd->GetYaxis()->SetTitle("Meu");
08383   this->SetGraphAxis(hMeuDriftCosThStd->GetXaxis(),
08384                      startTimeSecs,endTimeSecs+fudge);
08385 
08386   TH1F* hMeuDriftCosTh=new TH1F("hMeuDriftCosTh","hMeuDriftCosTh",
08387                                 numMonths,
08388                                 startTimeSecs,endTimeSecs+fudge);
08389   hMeuDriftCosTh->GetXaxis()->CenterTitle();
08390   hMeuDriftCosTh->GetYaxis()->CenterTitle();
08391   hMeuDriftCosTh->GetYaxis()->SetTitle("Meu");
08392   this->SetGraphAxis(hMeuDriftCosTh->GetXaxis(),
08393                      startTimeSecs,endTimeSecs+fudge);
08394 
08395   TH1F* hMeuDriftCosThX=new TH1F("hMeuDriftCosThX","hMeuDriftCosThX",
08396                                  numMonths,
08397                                  startTimeSecs,endTimeSecs+fudge);
08398   hMeuDriftCosThX->GetXaxis()->CenterTitle();
08399   hMeuDriftCosThX->GetYaxis()->CenterTitle();
08400   hMeuDriftCosThX->GetYaxis()->SetTitle("Meu");
08401   this->SetGraphAxis(hMeuDriftCosThX->GetXaxis(),
08402                      startTimeSecs,endTimeSecs+fudge);
08403 
08404   TH1F* hSigCorDriftCosThStd=new TH1F("hSigCorDriftCosThStd",
08405                                    "hSigCorDriftCosThStd",
08406                                    numMonths,
08407                                    startTimeSecs,endTimeSecs+fudge);
08408   hSigCorDriftCosThStd->GetXaxis()->CenterTitle();
08409   hSigCorDriftCosThStd->GetYaxis()->CenterTitle();
08410   hSigCorDriftCosThStd->GetYaxis()->SetTitle("SigCor");
08411   this->SetGraphAxis(hSigCorDriftCosThStd->GetXaxis(),
08412                      startTimeSecs,endTimeSecs+fudge);
08413 
08414   TH1F* hSigLinDriftCosThStd=new TH1F("hSigLinDriftCosThStd",
08415                                    "hSigLinDriftCosThStd",
08416                                    numMonths,
08417                                    startTimeSecs,endTimeSecs+fudge);
08418   hSigLinDriftCosThStd->GetXaxis()->CenterTitle();
08419   hSigLinDriftCosThStd->GetYaxis()->CenterTitle();
08420   hSigLinDriftCosThStd->GetYaxis()->SetTitle("SigLin");
08421   this->SetGraphAxis(hSigLinDriftCosThStd->GetXaxis(),
08422                      startTimeSecs,endTimeSecs+fudge);
08423 
08424   TH1F* hAdcDriftCosThStd=new TH1F("hAdcDriftCosThStd",
08425                                    "hAdcDriftCosThStd",
08426                                    numMonths,
08427                                    startTimeSecs,endTimeSecs+fudge);
08428   hAdcDriftCosThStd->GetXaxis()->CenterTitle();
08429   hAdcDriftCosThStd->GetYaxis()->CenterTitle();
08430   hAdcDriftCosThStd->GetYaxis()->SetTitle("Adc");
08431   this->SetGraphAxis(hAdcDriftCosThStd->GetXaxis(),
08432                      startTimeSecs,endTimeSecs+fudge);
08433 
08434   TH1F* hPeDriftCosThStd=new TH1F("hPeDriftCosThStd",
08435                                    "hPeDriftCosThStd",
08436                                    numMonths,
08437                                    startTimeSecs,endTimeSecs+fudge);
08438   hPeDriftCosThStd->GetXaxis()->CenterTitle();
08439   hPeDriftCosThStd->GetYaxis()->CenterTitle();
08440   hPeDriftCosThStd->GetYaxis()->SetTitle("Pe");
08441   this->SetGraphAxis(hPeDriftCosThStd->GetXaxis(),
08442                      startTimeSecs,endTimeSecs+fudge);
08443 
08444   TH1F* hSigLinOnlyDriftCosThStd=new TH1F("hSigLinOnlyDriftCosThStd",
08445                                    "hSigLinOnlyDriftCosThStd",
08446                                    numMonths,
08447                                    startTimeSecs,endTimeSecs+fudge);
08448   hSigLinOnlyDriftCosThStd->GetXaxis()->CenterTitle();
08449   hSigLinOnlyDriftCosThStd->GetYaxis()->CenterTitle();
08450   hSigLinOnlyDriftCosThStd->GetYaxis()->SetTitle("SigLinOnly");
08451   this->SetGraphAxis(hSigLinOnlyDriftCosThStd->GetXaxis(),
08452                      startTimeSecs,endTimeSecs+fudge);
08453 
08454   TH1F* hSigDrfDriftCosThStd=new TH1F("hSigDrfDriftCosThStd",
08455                                    "hSigDrfDriftCosThStd",
08456                                    numMonths,
08457                                    startTimeSecs,endTimeSecs+fudge);
08458   hSigDrfDriftCosThStd->GetXaxis()->CenterTitle();
08459   hSigDrfDriftCosThStd->GetYaxis()->CenterTitle();
08460   hSigDrfDriftCosThStd->GetYaxis()->SetTitle("SigDrf");
08461   this->SetGraphAxis(hSigDrfDriftCosThStd->GetXaxis(),
08462                      startTimeSecs,endTimeSecs+fudge);
08463 
08464   //need to use a standard RMS since when the bins have few entries
08465   //the rms is not well determined due to the Landau tail. However, it
08466   //is known from high statistics histograms.
08467   //the ND is significantly wider
08468   //26/April/07 added these:
08469   //ND data: 128.6 untruncated
08470   //ND MC:   118.2 untruncated
08471   //FD data: 103.6 untruncated
08472   //FD MC:    96.5 untruncated
08473   //Actually try cutting at 2000 (>10 sigma from peak?)
08474   Float_t stdMeuRMS=104;//was 95 on 26/April/07
08475   Float_t stdSigCorRMS=108;
08476   Float_t stdSigLinRMS=119;
08477   Float_t stdAdcRMS=119;
08478   Float_t stdPeRMS=1.6;//FD data
08479   if (det==Detector::kNear) {
08480     stdMeuRMS=122;//ND added on 26/April/07
08481     stdSigCorRMS=129;//same as meu
08482     stdSigLinRMS=143;
08483     stdAdcRMS=143;
08484     stdPeRMS=1.33;
08485   }
08486   
08487   //make the rms 10% bigger since that is what the error on the
08488   //median is (see thesis of J. Hartnell page 88)
08489   stdMeuRMS*=1.1;
08490   stdSigCorRMS*=1.1;
08491   stdSigLinRMS*=1.1;
08492   stdAdcRMS*=1.1;
08493   stdPeRMS*=1.1;
08494   
08495   //just copy the siglin value for these
08496   Float_t stdSigLinOnlyRMS=stdSigLinRMS;
08497   Float_t stdSigDrfRMS=stdSigLinRMS;
08498 
08499   MAXMSG("MeuPlots",Msg::kInfo,100)
08500     <<"For error on the median using high statistics rms = "
08501     <<" SigMaps"<<stdMeuRMS<<endl;
08502   
08503   quantile=0.5;
08504   for (Int_t i=0;i<numMonths;i++){
08505     Double_t meuStd=-1;
08506     Double_t meu=-1;
08507     Double_t meuX=-1;
08508     Double_t meuCosThStd=-1;
08509     Double_t meuCosTh=-1;
08510     Double_t meuCosThX=-1;
08511     Double_t sigCorCosThStd=-1;
08512     Double_t sigLinCosThStd=-1;
08513     Double_t adcCosThStd=-1;
08514     Double_t peCosThStd=-1;
08515     Double_t sigLinOnlyCosThStd=-1;
08516     Double_t sigDrfCosThStd=-1;
08517  
08518     meuDriftStd[i]->GetQuantiles(1,&meuStd,&quantile);
08519     meuDrift[i]->GetQuantiles(1,&meu,&quantile);
08520     meuDriftX[i]->GetQuantiles(1,&meuX,&quantile);
08521     meuDriftCosThStd[i]->GetQuantiles(1,&meuCosThStd,&quantile);
08522     meuDriftCosTh[i]->GetQuantiles(1,&meuCosTh,&quantile);
08523     meuDriftCosThX[i]->GetQuantiles(1,&meuCosThX,&quantile);
08524     sigCorDriftCosThStd[i]->GetQuantiles(1,&sigCorCosThStd,&quantile);
08525     sigLinDriftCosThStd[i]->GetQuantiles(1,&sigLinCosThStd,&quantile);
08526     adcDriftCosThStd[i]->GetQuantiles(1,&adcCosThStd,&quantile);
08527     peDriftCosThStd[i]->GetQuantiles(1,&peCosThStd,&quantile);
08528     sigLinOnlyDriftCosThStd[i]->GetQuantiles(1,&sigLinOnlyCosThStd,&quantile);
08529     sigDrfDriftCosThStd[i]->GetQuantiles(1,&sigDrfCosThStd,&quantile);
08530 
08531 
08532     Float_t nStd=meuDriftStd[i]->GetEntries();
08533     Float_t n=meuDrift[i]->GetEntries();
08534     Float_t nX=meuDriftX[i]->GetEntries();
08535     Float_t nCosThStd=meuDriftCosThStd[i]->GetEntries();
08536     Float_t nCosTh=meuDriftCosTh[i]->GetEntries();
08537     Float_t nCosThX=meuDriftCosThX[i]->GetEntries();
08538     Float_t nSigCorCosThStd=sigCorDriftCosThStd[i]->GetEntries();
08539     Float_t nSigLinCosThStd=sigLinDriftCosThStd[i]->GetEntries();
08540     Float_t nAdcCosThStd=adcDriftCosThStd[i]->GetEntries();
08541     Float_t nPeCosThStd=peDriftCosThStd[i]->GetEntries();
08542     Float_t nSigLinOnlyCosThStd=sigLinOnlyDriftCosThStd[i]->GetEntries();
08543     Float_t nSigDrfCosThStd=sigDrfDriftCosThStd[i]->GetEntries();
08544     Float_t errStd=0;
08545     Float_t err=0;
08546     Float_t errX=0;
08547     Float_t errCosThStd=0;
08548     Float_t errCosTh=0;
08549     Float_t errCosThX=0;
08550     Float_t errSigCorCosThStd=0;
08551     Float_t errSigLinCosThStd=0;
08552     Float_t errAdcCosThStd=0;
08553     Float_t errPeCosThStd=0;
08554     Float_t errSigLinOnlyCosThStd=0;
08555     Float_t errSigDrfCosThStd=0;
08556 
08557     //if (nStd) errStd=meuDriftStd[i]->GetRMS()/sqrt(nStd);
08558     //if (n) err=meuDrift[i]->GetRMS()/sqrt(n);
08559     //if (nX) errX=meuDriftX[i]->GetRMS()/sqrt(nX);
08560     //if (nCosThStd) errCosThStd=
08561     //       meuDriftCosThStd[i]->GetRMS()/sqrt(nCosThStd);
08562     //if (nCosTh) errCosTh=meuDriftCosTh[i]->GetRMS()/sqrt(nCosTh);
08563     //if (nCosThX) errCosThX=meuDriftCosThX[i]->GetRMS()/sqrt(nCosThX);
08564 
08565     if (nStd) errStd=stdMeuRMS/sqrt(nStd);
08566     if (n) err=stdMeuRMS/sqrt(n);
08567     if (nX) errX=stdMeuRMS/sqrt(nX);
08568     if (nCosThStd) errCosThStd=stdMeuRMS/sqrt(nCosThStd);
08569     if (nCosTh) errCosTh=stdMeuRMS/sqrt(nCosTh);
08570     if (nCosThX) errCosThX=stdMeuRMS/sqrt(nCosThX);
08571     if (nSigCorCosThStd) errSigCorCosThStd=stdSigCorRMS/
08572                            sqrt(nSigCorCosThStd);
08573     if (nSigLinCosThStd) errSigLinCosThStd=stdSigLinRMS/
08574                            sqrt(nSigLinCosThStd);
08575     if (nAdcCosThStd) errAdcCosThStd=stdAdcRMS/sqrt(nAdcCosThStd);
08576     if (nPeCosThStd) errPeCosThStd=stdPeRMS/sqrt(nPeCosThStd);
08577     if (nSigLinOnlyCosThStd) errSigLinOnlyCosThStd=stdSigLinOnlyRMS/
08578                            sqrt(nSigLinOnlyCosThStd);
08579     if (nSigDrfCosThStd) errSigDrfCosThStd=stdSigDrfRMS/
08580                            sqrt(nSigDrfCosThStd);
08581     
08582     //reset the median value if no entries
08583     if (!nStd) meuStd=0;
08584     if (!n) meu=0;
08585     if (!nX) meuX=0;
08586     if (!nCosThStd) meuCosThStd=0;
08587     if (!nCosTh) meuCosTh=0;
08588     if (!nCosThX) meuCosThX=0;
08589     if (!nSigCorCosThStd) sigCorCosThStd=0;
08590     if (!nSigLinCosThStd) sigLinCosThStd=0;
08591     if (!nAdcCosThStd) adcCosThStd=0;
08592     if (!nPeCosThStd) peCosThStd=0;
08593     if (!nSigLinOnlyCosThStd) sigLinOnlyCosThStd=0;
08594     if (!nSigDrfCosThStd) sigDrfCosThStd=0;
08595 
08596     //fill the bins!
08597     hMeuDriftN->SetBinContent(i+1,n);
08598 
08599     hMeuDriftStd->SetBinContent(i+1,meuStd);
08600     hMeuDriftStd->SetBinError(i+1,errStd);
08601     hMeuDrift->SetBinContent(i+1,meu);
08602     hMeuDrift->SetBinError(i+1,err);
08603     hMeuDriftX->SetBinContent(i+1,meuX);
08604     hMeuDriftX->SetBinError(i+1,errX);
08605     hMeuDriftCosThStd->SetBinContent(i+1,meuCosThStd);
08606     hMeuDriftCosThStd->SetBinError(i+1,errCosThStd);
08607     hMeuDriftCosTh->SetBinContent(i+1,meuCosTh);
08608     hMeuDriftCosTh->SetBinError(i+1,errCosTh);
08609     hMeuDriftCosThX->SetBinContent(i+1,meuCosThX);
08610     hMeuDriftCosThX->SetBinError(i+1,errCosThX);
08611     hSigCorDriftCosThStd->SetBinContent(i+1,sigCorCosThStd);
08612     hSigCorDriftCosThStd->SetBinError(i+1,errSigCorCosThStd);
08613     hSigLinDriftCosThStd->SetBinContent(i+1,sigLinCosThStd);
08614     hSigLinDriftCosThStd->SetBinError(i+1,errSigLinCosThStd);
08615     hAdcDriftCosThStd->SetBinContent(i+1,adcCosThStd);
08616     hAdcDriftCosThStd->SetBinError(i+1,errAdcCosThStd);
08617     hPeDriftCosThStd->SetBinContent(i+1,peCosThStd);
08618     hPeDriftCosThStd->SetBinError(i+1,errPeCosThStd);
08619     hSigLinOnlyDriftCosThStd->SetBinContent(i+1,sigLinOnlyCosThStd);
08620     hSigLinOnlyDriftCosThStd->SetBinError(i+1,errSigLinOnlyCosThStd);
08621     hSigDrfDriftCosThStd->SetBinContent(i+1,sigDrfCosThStd);
08622     hSigDrfDriftCosThStd->SetBinError(i+1,errSigDrfCosThStd);
08623 
08624     MAXMSG("MeuPlots",Msg::kInfo,100)
08625       <<"bin="<<i+1
08626       <<", meuStd="<<meuStd<<" +/- "<<errStd
08627       <<", meu="<<meu<<" +/- "<<err
08628       <<", meuX="<<meuX<<" +/- "<<errX
08629       <<endl;
08630   }
08631 
08633   //time, meu and temperature
08634   //
08635   MSG("MeuPlots",Msg::kInfo)<<"Filling vs. Temperature plots..."<<endl;
08636   TProfile* pTempVsTime15=new TProfile("pTempVsTime15",
08637                                        "pTempVsTime15",15,
08638                                        startTimeSecs,endTimeSecs+fudge);
08639   this->TProfileFill(pTempVsTime15,vTimeSecTemp,vTemperatures);
08640   this->SetGraphAxis(pTempVsTime15->GetXaxis(),
08641                      startTimeSecs,endTimeSecs+fudge);
08642   pTempVsTime15->GetXaxis()->CenterTitle();
08643   pTempVsTime15->GetYaxis()->SetTitle("Temperature (C)");
08644   pTempVsTime15->GetYaxis()->CenterTitle();
08645 
08646   TProfile* pMeuVsTemp15=new TProfile("pMeuVsTemp15",
08647                                       "pMeuVsTemp15",20,18,24);
08648   this->TProfileFill(pMeuVsTemp15,vTemperatures,vWinSigMapTemp);
08649   pMeuVsTemp15->GetXaxis()->SetTitle("Temperature (C)");
08650   pMeuVsTemp15->GetXaxis()->CenterTitle();
08651   pMeuVsTemp15->GetYaxis()->SetTitle("MEU");
08652   pMeuVsTemp15->GetYaxis()->CenterTitle();
08653 
08654   TProfile* pMeuVsTempN15=new TProfile("pMeuVsTempN15",
08655                                        "pMeuVsTempN15",20,18,24);
08656   this->ScaleVector(vWinSigMapTemp,1/517.);
08657   this->TProfileFill(pMeuVsTempN15,vTemperatures,vWinSigMapTemp);
08658   pMeuVsTempN15->GetXaxis()->SetTitle("Temperature (C)");
08659   pMeuVsTempN15->GetXaxis()->CenterTitle();
08660   pMeuVsTempN15->GetYaxis()->SetTitle("MEU");
08661   pMeuVsTempN15->GetYaxis()->CenterTitle();
08662 
08663   MSG("MeuPlots",Msg::kInfo) 
08664     <<" ** Finished MakeValidationPlots method **"<<endl;
08665 }

void MeuPlots::MeuSystematics (  ) 

Definition at line 1060 of file MeuPlots.cxx.

References EpochTo1995(), fEntries, fOutFile, fS, InitialiseLoopVariables(), Msg::kDebug, Msg::kInfo, MAXMSG, MSG, OpenFile(), SetGraphAxis(), SetLoopVariables(), MeuSummary::SM2, TGraphVect(), MeuSummary::TimeSec, TProfileFill(), MeuSummary::WinAdc, MeuSummary::WinAvCosThetaZ, MeuSummary::WinSigCor, MeuSummary::WinSigLin, MeuSummary::WinSigMap, MeuSummary::WinStopSideLPos, MeuSummary::WinStopSidePl, MeuSummary::WinStopSideTPos, MeuSummary::WinStopSideX, MeuSummary::WinStopSideY, MeuSummary::WinStopSideZ, MeuSummary::WinVtxSideLPos, MeuSummary::WinVtxSidePl, MeuSummary::WinVtxSideStrip, MeuSummary::WinVtxSideTPos, MeuSummary::WinVtxSideView, MeuSummary::WinVtxSideX, MeuSummary::WinVtxSideY, and MeuSummary::WinVtxSideZ.

01061 {
01062   
01063   MSG("MeuPlots",Msg::kInfo) 
01064     <<" ** Running MeuSystematics method... **"<<endl;
01065 
01066   //open the output file for the histograms
01067   fOutFile=this->OpenFile(46,"MeuGeom");  
01068 
01069   vector<Double_t> vTimeSec;
01070   vTimeSec.reserve(fEntries);//save lots of actual push backs
01071   Int_t startTimeSecs=2000000000;//2 billion
01072   Int_t endTimeSecs=1;
01073   Int_t div=2;
01074   vector<Double_t> vMeuAdc;
01075   vMeuAdc.reserve(fEntries/div);
01076   vector<Double_t> vMeuSigLin;
01077   vMeuSigLin.reserve(fEntries/div);
01078   vector<Double_t> vMeuSigCor;
01079   vMeuSigCor.reserve(fEntries/div);
01080   vector<Double_t> vMeuSigCorNoCut;
01081   vMeuSigCorNoCut.reserve(fEntries/div);
01082   vector<Double_t> vMeuSigMap;
01083   vMeuSigMap.reserve(fEntries/div);
01084   vector<Double_t> vMeuSigMapNoCut;
01085   vMeuSigMapNoCut.reserve(fEntries/div);
01086   vector<Double_t> vWinPl;
01087   vWinPl.reserve(fEntries/div);
01088 
01089   //window at the vtx end
01090   //vector<Double_t> vWinVtxSidePl;
01091   //vWinVtxSidePl.reserve(fEntries);
01092   vector<Double_t> vMeuV2;
01093   vMeuV2.reserve(fEntries/div);
01094   vector<Double_t> vWinVtxSideTPosV2;
01095   vWinVtxSideTPosV2.reserve(fEntries/div);
01096   vector<Double_t> vWinVtxSideLPosV2;
01097   vWinVtxSideLPosV2.reserve(fEntries/div);
01098   vector<Double_t> vWinVtxSideStripV2;
01099   vWinVtxSideStripV2.reserve(fEntries/div);
01100   vector<Double_t> vMeuV3;
01101   vMeuV3.reserve(fEntries/div);
01102   vector<Double_t> vWinVtxSideTPosV3;
01103   vWinVtxSideTPosV3.reserve(fEntries/div);
01104   vector<Double_t> vWinVtxSideLPosV3;
01105   vWinVtxSideLPosV3.reserve(fEntries/div);
01106   vector<Double_t> vWinVtxSideStripV3;
01107   vWinVtxSideStripV3.reserve(fEntries/div);
01108   
01109   vector<Double_t> vMeuYvsX;
01110   vMeuYvsX.reserve(fEntries/div);
01111   vector<Double_t> vWinVtxSideX;
01112   vWinVtxSideX.reserve(fEntries/div);
01113   vector<Double_t> vWinVtxSideY;
01114   vWinVtxSideY.reserve(fEntries/div);
01115   //vector<Double_t> vWinVtxSideZ;
01116   //vWinVtxSideZ.reserve(fEntries);
01117   //vector<Double_t> vWinVtxSideStrip;
01118   //vWinVtxSideStrip.reserve(fEntries);
01119 
01120   //window at the stopping end
01121   //vector<Double_t> vWinStopSidePl;
01122   //vWinStopSidePl.reserve(fEntries);
01123   //vector<Double_t> vWinStopSideView;
01124   //vWinStopSideView.reserve(fEntries);
01125   vector<Double_t> vWinStopSideX;
01126   vWinStopSideX.reserve(fEntries/div);
01127   vector<Double_t> vWinStopSideY;
01128   vWinStopSideY.reserve(fEntries/div);
01129   //vector<Double_t> vWinStopSideZ;
01130   //vWinStopSideZ.reserve(fEntries);
01131   //vector<Double_t> vWinStopSideTPos;
01132   //vWinStopSideTPos.reserve(fEntries);
01133   //vector<Double_t> vWinStopSideLPos;
01134   //vWinStopSideLPos.reserve(fEntries);
01135   //vector<Double_t> vWinStopSideStrip;
01136   //vWinStopSideStrip.reserve(fEntries);
01137   
01138   vector<Double_t> vWinCosThetaY;
01139   vWinCosThetaY.reserve(fEntries/div);
01140   vector<Double_t> vWinCosThetaZ;
01141   vWinCosThetaZ.reserve(fEntries/div);
01142 
01143   TH1F* hWinSigMap=new TH1F("hWinSigMap","hWinSigMap",1000,-1,3000);
01144   hWinSigMap->SetFillColor(0);
01145   hWinSigMap->SetTitle("hWinSigMap");
01146   hWinSigMap->GetXaxis()->SetTitle("SigMap");
01147   hWinSigMap->GetXaxis()->CenterTitle();
01148   //hWinSigMap->SetBit(TH1::kCanRebin);
01149 
01150   TH1F* hThetaY=new TH1F("hThetaY","hThetaY",100,-1,1);
01151   hThetaY->SetFillColor(0);
01152   hThetaY->SetTitle("Cos(#theta_{Y})");
01153   hThetaY->GetXaxis()->SetTitle("Cos(#theta_{Y})");
01154   hThetaY->GetXaxis()->CenterTitle();
01155 
01156   TH1F* hThetaZ=new TH1F("hThetaZ","hThetaZ",100,-1,1);
01157   hThetaZ->SetFillColor(0);
01158   hThetaZ->SetTitle("Cos(#theta_{Z})");
01159   hThetaZ->GetXaxis()->SetTitle("Cos(#theta_{Z})");
01160   hThetaZ->GetXaxis()->CenterTitle();
01161 
01162   TH1F* hWinPl=new TH1F("hWinPl","hWinPl",243,0,485);
01163   hWinPl->SetTitle("Track Window Position in Detector");
01164   hWinPl->GetXaxis()->SetTitle("Plane");
01165   hWinPl->GetXaxis()->CenterTitle();
01166   hWinPl->GetYaxis()->SetTitle("");
01167   hWinPl->GetYaxis()->CenterTitle();
01168   hWinPl->SetLineColor(2);
01169   hWinPl->SetFillColor(0);
01170   //hWinPl->SetBit(TH1::kCanRebin);
01171 
01172   TH2F* hYvsXWinVtxSide=new TH2F("hYvsXWinVtxSide","hYvsXWinVtxSide",
01173                                  60,-4,4,60,-4,4);
01174   hYvsXWinVtxSide->SetTitle("Track Window Position (Muon-Entry Side)");
01175   hYvsXWinVtxSide->GetXaxis()->SetTitle("X (m)");
01176   hYvsXWinVtxSide->GetXaxis()->CenterTitle();
01177   hYvsXWinVtxSide->GetYaxis()->SetTitle("Y (m)");
01178   hYvsXWinVtxSide->GetYaxis()->CenterTitle();
01179   hYvsXWinVtxSide->SetLineColor(2);
01180   hYvsXWinVtxSide->SetFillColor(0);
01181   //hYvsXWinVtxSide->SetBit(TH1::kCanRebin);
01182 
01183   TH2F* hYvsXWinStopSide=new TH2F("hYvsXWinStopSide","hYvsXWinStopSide",
01184                                   60,-4,4,60,-4,4);
01185   hYvsXWinStopSide->SetTitle("Track Window Position (Muon-Stop Side)");
01186   hYvsXWinStopSide->GetXaxis()->SetTitle("X (m)");
01187   hYvsXWinStopSide->GetXaxis()->CenterTitle();
01188   hYvsXWinStopSide->GetYaxis()->SetTitle("Y (m)");
01189   hYvsXWinStopSide->GetYaxis()->CenterTitle();
01190   hYvsXWinStopSide->SetLineColor(2);
01191   hYvsXWinStopSide->SetFillColor(0);
01192   //hYvsXWinStopSide->SetBit(TH1::kCanRebin);
01193 
01194   string sCalType="";
01195 
01199   
01200   this->InitialiseLoopVariables();  
01201   
01202   for(Int_t entry=0;entry<fEntries;entry++){
01203     
01204     this->SetLoopVariables(entry);
01205 
01206     MeuSummary& t=(*fMeuSummary);
01207 
01209     //loop over MeuHitInfo hits
01211     //TClonesArray& MeuHitInfo=(*t.STMeuHitInfo);
01212     //Int_t numHits=MeuHitInfo.GetEntries();
01213     //loop over the truth hits
01214     //for (Int_t hit=0;hit<numHits;hit++){
01215     //const STMeuHitInfo* calPosHit=
01216     //dynamic_cast<STMeuHitInfo*>(MeuHitInfo[hit]);
01217     //const STMeuHitInfo& cp=(*calPosHit);
01218     //cp.Plane;
01219     //cout<<"cp.Plane="<<cp.Plane<<endl;
01220     //}
01221 
01222     //only use august onwards - Phil S used Aug-Oct 2004 for sts cal.
01223     if (t.TimeSec<1091318400) continue;
01224         
01225     //if there was a good window
01226     if (t.WinSigMap>0){
01227 
01228       if (fabs(t.WinAvCosThetaZ)>0.5){
01229         hWinSigMap->Fill(t.WinSigMap);
01230         MAXMSG("MeuPlots",Msg::kInfo,100)
01231           <<"Filling...  t.WinAvCosThetaZ="<<t.WinAvCosThetaZ<<endl;
01232       }
01233       else {
01234         MAXMSG("MeuPlots",Msg::kInfo,100)
01235           <<"t.WinAvCosThetaZ="<<t.WinAvCosThetaZ<<endl;
01236       }
01237 
01238       //get the brem cut variables
01239       vMeuSigMapNoCut.push_back(t.WinSigMap/14);
01240       vMeuSigCorNoCut.push_back(t.WinSigCor/14);
01241 
01242       if (t.WinSigMap>200 && t.WinSigMap<1500){//was 238 1700
01243 
01244         Float_t enDep=t.WinSigMap;
01245         sCalType="SigMap";
01246         
01247         Int_t evTime=t.TimeSec;
01248         vTimeSec.push_back(evTime);
01249         vMeuAdc.push_back(t.WinAdc);
01250         vMeuSigLin.push_back(t.WinSigLin);
01251         vMeuSigCor.push_back(t.WinSigCor);
01252         vMeuSigMap.push_back(t.WinSigMap);
01253 
01254         //get the min and max times
01255         if (evTime>endTimeSecs) endTimeSecs=evTime;
01256         if (evTime<startTimeSecs && evTime>0) startTimeSecs=evTime;
01257         if (evTime<=0) {
01258           cout<<"Bad time="<<evTime<<endl;
01259         }
01260         
01261         //calc the angles
01262         Float_t r2=pow(t.WinVtxSideX-t.WinStopSideX,2)+
01263           pow(t.WinVtxSideY-t.WinStopSideY,2)+
01264           pow(t.WinVtxSideZ-t.WinStopSideZ,2);
01265         Float_t cosThetaY=-2;
01266         Float_t cosThetaZ=-2;
01267         if (r2>0){
01268           Float_t r=sqrt(r2);
01269           cosThetaY=(t.WinVtxSideY-t.WinStopSideY)/r;
01270           cosThetaZ=(t.WinVtxSideZ-t.WinStopSideZ)/r;
01271         }
01272         vWinCosThetaY.push_back(cosThetaY);
01273         vWinCosThetaZ.push_back(cosThetaZ);
01274         hThetaY->Fill(cosThetaY);
01275         hThetaZ->Fill(cosThetaZ);
01276 
01277         //find the pl in the middle of the window and fill histo
01278         Int_t pl=t.WinStopSidePl;
01279         if (t.WinVtxSidePl<t.WinStopSidePl) pl=t.WinVtxSidePl;
01280         pl+=abs(t.WinVtxSidePl-t.WinStopSidePl)/2;
01281         hWinPl->Fill(pl);
01282         vWinPl.push_back(pl);
01283 
01284         if (t.SM2){//temporary cut
01285 
01286           //fill the xy plots
01287           if (t.WinVtxSideX>-99 && t.WinVtxSideY>-99 &&
01288               t.WinStopSideX>-99 && t.WinStopSideY>-99){
01289             vMeuYvsX.push_back(enDep);
01290             vWinVtxSideX.push_back(t.WinVtxSideX);
01291             vWinVtxSideY.push_back(t.WinVtxSideY);
01292             vWinStopSideX.push_back(t.WinStopSideX);
01293             vWinStopSideY.push_back(t.WinStopSideY);
01294             hYvsXWinVtxSide->Fill(t.WinVtxSideX,t.WinVtxSideY);
01295             hYvsXWinStopSide->Fill(t.WinStopSideX,t.WinStopSideY);
01296           }
01297           else{
01298             MSG("MeuPlots",Msg::kDebug)
01299               <<"Crazy X and Y positions:"<<endl
01300               <<"  WinVtxSide: x="<<t.WinVtxSideX<<", y="<<t.WinVtxSideY
01301               <<endl
01302               <<"  WinStopSide: x="<<t.WinStopSideX<<", y="<<t.WinStopSideY
01303               <<endl;
01304           }
01305 
01306           //fill the different views
01307           if (t.WinVtxSideTPos>-99 && t.WinVtxSideLPos>-99 &&
01308               t.WinStopSideTPos>-99 && t.WinStopSideLPos>-99){
01309             if (t.WinVtxSideView==2){
01310               vMeuV2.push_back(enDep);
01311               vWinVtxSideTPosV2.push_back(t.WinVtxSideTPos);
01312               vWinVtxSideLPosV2.push_back(t.WinVtxSideLPos);
01313               vWinVtxSideStripV2.push_back(t.WinVtxSideStrip);
01314             }
01315             if (t.WinVtxSideView==3){
01316               vMeuV3.push_back(enDep);
01317               vWinVtxSideTPosV3.push_back(t.WinVtxSideTPos);
01318               vWinVtxSideLPosV3.push_back(t.WinVtxSideLPos);
01319               vWinVtxSideStripV3.push_back(t.WinVtxSideStrip);
01320             }
01321           }
01322         }
01323       }
01324     }    
01325   }//end of for                                       
01326   
01330 
01331   MSG("MeuPlots",Msg::kInfo)<<"Finished main loop"<<endl;
01332 
01333   MSG("MeuPlots",Msg::kInfo)
01334     <<"Start time="<<startTimeSecs<<", endTime="<<endTimeSecs<<endl;
01335   //convert the time to epoch starting in 1995
01336   this->EpochTo1995(vTimeSec);
01337   this->EpochTo1995(endTimeSecs);
01338   this->EpochTo1995(startTimeSecs);
01339 
01343   TCanvas *cMeuAdcVsTime=new TCanvas("cMeuAdcVsTime","cMeuAdcVsTime",
01344                                      0,0,800,1000);
01345   cMeuAdcVsTime->SetFillColor(0);
01346   cMeuAdcVsTime->Divide(1,2);
01347   cMeuAdcVsTime->cd(1);
01348   TGraph* gMeuAdcVsTime=this->TGraphVect(vTimeSec,vMeuAdc);
01349   if (gMeuAdcVsTime){
01350     cout<<"Drawing plots..."<<endl;
01351     gMeuAdcVsTime->Draw("ap");
01352     this->SetGraphAxis(gMeuAdcVsTime->GetXaxis(),
01353                        startTimeSecs,endTimeSecs);
01354     gMeuAdcVsTime->SetMarkerStyle(3);
01355     gMeuAdcVsTime->SetMarkerColor(3);
01356     gMeuAdcVsTime->SetMarkerSize(1);
01357     gMeuAdcVsTime->SetTitle("MEU in ADCs vs Time");
01358     //gMeuAdcVsTime->GetXaxis()->SetTitle("Entry");
01359     gMeuAdcVsTime->GetXaxis()->CenterTitle();
01360     gMeuAdcVsTime->GetYaxis()->SetTitle("MEU");
01361     gMeuAdcVsTime->GetYaxis()->CenterTitle();
01362     gMeuAdcVsTime->Write("gMeuAdcVsTime");
01363   }
01364   cout<<"Drawing plots2..."<<endl;
01365   Int_t numBins=static_cast<Int_t>((vTimeSec.size()/600)+1);
01366   TProfile* pMeuAdcVsTime=new TProfile("pMeuAdcVsTime","pMeuAdcVsTime",
01367                                        numBins,
01368                                        startTimeSecs,endTimeSecs);
01369   this->TProfileFill(pMeuAdcVsTime,vTimeSec,vMeuAdc);
01370   cMeuAdcVsTime->cd(2);
01371   pMeuAdcVsTime->Draw();
01372   this->SetGraphAxis(pMeuAdcVsTime->GetXaxis(),
01373                      startTimeSecs,endTimeSecs);
01374   pMeuAdcVsTime->SetMarkerStyle(3);
01375   pMeuAdcVsTime->SetMarkerColor(3);
01376   pMeuAdcVsTime->SetMarkerSize(1);
01377   pMeuAdcVsTime->SetTitle("MEU in ADCs vs Time");
01378   //pMeuAdcVsTime->GetXaxis()->SetTitle("Entry");
01379   pMeuAdcVsTime->GetXaxis()->CenterTitle();
01380   pMeuAdcVsTime->GetYaxis()->SetTitle("MEU");
01381   pMeuAdcVsTime->GetYaxis()->CenterTitle();
01382   //pMeuAdcVsTime->Fit("pol1");//causing fpe in minuit!
01383 
01384   cout<<"Drawing plots..."<<endl;
01388   TCanvas *cMeuVsTime=new TCanvas("cMeuVsTime","cMeuVsTime",
01389                                   0,0,800,1000);
01390   cMeuVsTime->SetFillColor(0);
01391   cMeuVsTime->Divide(1,2);
01392   cMeuVsTime->cd(1);
01393   TGraph* gMeuVsTime=this->TGraphVect(vTimeSec,vMeuSigCor);
01394   if (gMeuVsTime){
01395     gMeuVsTime->Draw("ap");
01396     this->SetGraphAxis(gMeuVsTime->GetXaxis(),
01397                        startTimeSecs,endTimeSecs);
01398     gMeuVsTime->SetMarkerStyle(3);
01399     gMeuVsTime->SetMarkerColor(3);
01400     gMeuVsTime->SetMarkerSize(1);
01401     gMeuVsTime->SetTitle("MEU in Strip To Strip Corrected ADCs (SigCors) vs Time");
01402     //gMeuVsTime->GetXaxis()->SetTitle("Entry");
01403     gMeuVsTime->GetXaxis()->CenterTitle();
01404     gMeuVsTime->GetYaxis()->SetTitle("MEU");
01405     gMeuVsTime->GetYaxis()->CenterTitle();
01406     gMeuVsTime->Write("gMeuVsTime");
01407   }
01408   TProfile* pMeuVsTime=new TProfile("pMeuVsTime","pMeuVsTime",
01409                                     numBins,
01410                                     startTimeSecs,endTimeSecs);
01411   this->TProfileFill(pMeuVsTime,vTimeSec,vMeuSigCor);
01412   cMeuVsTime->cd(2);
01413   pMeuVsTime->Draw();
01414   this->SetGraphAxis(pMeuVsTime->GetXaxis(),
01415                      startTimeSecs,endTimeSecs);
01416   pMeuVsTime->SetMarkerStyle(3);
01417   pMeuVsTime->SetMarkerColor(3);
01418   pMeuVsTime->SetMarkerSize(1);
01419   pMeuVsTime->SetTitle("Profile of MEU in Strip To Strip Corrected ADCs (SigCors) vs Time");
01420   //pMeuVsTime->GetXaxis()->SetTitle("Entry");
01421   pMeuVsTime->GetXaxis()->CenterTitle();
01422   pMeuVsTime->GetYaxis()->SetTitle("MEU");
01423   pMeuVsTime->GetYaxis()->CenterTitle();
01424   //pMeuVsTime->Fit("pol1");
01425 
01426   cout<<"Drawing plots..."<<endl;  
01430   TCanvas *cMeuVsGeom=new TCanvas("cMeuVsGeom","cMeuVsGeom",
01431                                   0,0,1000,1000);
01432   cMeuVsGeom->SetFillColor(0);
01433   cMeuVsGeom->Divide(3,2);
01434   cMeuVsGeom->cd(1);
01435   TGraph* gMeuAdcVsPlane=this->TGraphVect(vWinPl,vMeuAdc);
01436   if (gMeuAdcVsPlane){
01437     gMeuAdcVsPlane->Draw("ap");
01438     gMeuAdcVsPlane->SetMarkerStyle(3);
01439     gMeuAdcVsPlane->SetMarkerColor(3);
01440     gMeuAdcVsPlane->SetMarkerSize(1);
01441     gMeuAdcVsPlane->SetTitle("MEU in ADCs vs Plane");
01442     gMeuAdcVsPlane->GetXaxis()->SetTitle("Plane");
01443     gMeuAdcVsPlane->GetXaxis()->CenterTitle();
01444     gMeuAdcVsPlane->GetYaxis()->SetTitle("MEU");
01445     gMeuAdcVsPlane->GetYaxis()->CenterTitle();
01446     gMeuAdcVsPlane->Write("gMeuAdcVsPlane");
01447   }
01448   cMeuVsGeom->cd(2);
01449   TGraph* gMeuSigLinVsPlane=this->TGraphVect(vWinPl,vMeuSigLin);
01450   if (gMeuSigLinVsPlane){
01451     gMeuSigLinVsPlane->Draw("ap");
01452     gMeuSigLinVsPlane->SetMarkerStyle(3);
01453     gMeuSigLinVsPlane->SetMarkerColor(3);
01454     gMeuSigLinVsPlane->SetMarkerSize(1);
01455     gMeuSigLinVsPlane->SetTitle("MEU in Gain Corrected ADCs (like PEs) vs Plane");
01456     gMeuSigLinVsPlane->GetXaxis()->SetTitle("Plane");
01457     gMeuSigLinVsPlane->GetXaxis()->CenterTitle();
01458     gMeuSigLinVsPlane->GetYaxis()->SetTitle("MEU");
01459     gMeuSigLinVsPlane->GetYaxis()->CenterTitle();
01460     gMeuSigLinVsPlane->Write("gMeuSigLinVsPlane");
01461   }
01462   cMeuVsGeom->cd(3);
01463   TGraph* gMeuSigCorVsPlane=this->TGraphVect(vWinPl,vMeuSigCor);
01464   if (gMeuSigCorVsPlane){
01465     gMeuSigCorVsPlane->Draw("ap");
01466     gMeuSigCorVsPlane->SetMarkerStyle(3);
01467     gMeuSigCorVsPlane->SetMarkerColor(3);
01468     gMeuSigCorVsPlane->SetMarkerSize(1);
01469     gMeuSigCorVsPlane->SetTitle("MEU in Strip to Strip Corrected ADCs (SigCors) vs Plane");
01470     gMeuSigCorVsPlane->GetXaxis()->SetTitle("Plane");
01471     gMeuSigCorVsPlane->GetXaxis()->CenterTitle();
01472     gMeuSigCorVsPlane->GetYaxis()->SetTitle("MEU");
01473     gMeuSigCorVsPlane->GetYaxis()->CenterTitle();
01474     gMeuSigCorVsPlane->Write("gMeuSigCorVsPlane");
01475   }
01476   cMeuVsGeom->cd(4);
01477   Int_t nPlBins=static_cast<Int_t>((vWinPl.size()/600)+1);
01478   if (nPlBins>486) nPlBins=486;
01479   TProfile* pMeuAdcVsPlane=new TProfile("pMeuAdcVsPlane",
01480                                         "pMeuAdcVsPlane",
01481                                         nPlBins,0,485);
01482   this->TProfileFill(pMeuAdcVsPlane,vWinPl,vMeuAdc);
01483   pMeuAdcVsPlane->Draw();
01484   pMeuAdcVsPlane->SetTitle("MEU in ADCs vs Plane");
01485   pMeuAdcVsPlane->GetXaxis()->SetTitle("Plane");
01486   pMeuAdcVsPlane->GetXaxis()->CenterTitle();
01487   pMeuAdcVsPlane->GetYaxis()->SetTitle("MEU");
01488   pMeuAdcVsPlane->GetYaxis()->CenterTitle();
01489   cMeuVsGeom->cd(5);
01490   TProfile* pMeuSigLinVsPlane=new TProfile("pMeuSigLinVsPlane",
01491                                            "pMeuSigLinVsPlane",
01492                                            nPlBins,0,485);
01493   this->TProfileFill(pMeuSigLinVsPlane,vWinPl,vMeuSigLin);
01494   pMeuSigLinVsPlane->Draw();
01495   pMeuSigLinVsPlane->SetTitle("MEU in Gain Corrected ADCs (like PEs) vs Plane");
01496   pMeuSigLinVsPlane->GetXaxis()->SetTitle("Plane");
01497   pMeuSigLinVsPlane->GetXaxis()->CenterTitle();
01498   pMeuSigLinVsPlane->GetYaxis()->SetTitle("MEU");
01499   pMeuSigLinVsPlane->GetYaxis()->CenterTitle();
01500   cMeuVsGeom->cd(6);
01501   TProfile* pMeuSigCorVsPlane=new TProfile("pMeuSigCorVsPlane",
01502                                            "pMeuSigCorVsPlane",
01503                                            nPlBins,0,485);
01504   this->TProfileFill(pMeuSigCorVsPlane,vWinPl,vMeuSigCor);
01505   pMeuSigCorVsPlane->Draw();
01506   pMeuSigCorVsPlane->SetTitle("MEU in Strip to Strip Corrected ADCs (SigCors) vs Plane");
01507   pMeuSigCorVsPlane->GetXaxis()->SetTitle("Plane");
01508   pMeuSigCorVsPlane->GetXaxis()->CenterTitle();
01509   pMeuSigCorVsPlane->GetYaxis()->SetTitle("MEU");
01510   pMeuSigCorVsPlane->GetYaxis()->CenterTitle();
01511   //hWinPl->Draw();
01512 
01513   cout<<"Drawing plots..."<<endl;
01517   TCanvas *cMeuVsPlane1=new TCanvas("cMeuVsPlane1","cMeuVsPlane1",
01518                                     0,0,1000,1000);
01519   cMeuVsPlane1->SetFillColor(0);
01520   cMeuVsPlane1->Divide(2,2);
01521   cMeuVsPlane1->cd(1);
01522   TProfile* pMeuAdcVsPlane1=new TProfile("pMeuAdcVsPlane1",
01523                                          "pMeuAdcVsPlane1",
01524                                          486,0,486);
01525   this->TProfileFill(pMeuAdcVsPlane1,vWinPl,vMeuAdc);
01526   pMeuAdcVsPlane1->Draw();
01527   pMeuAdcVsPlane1->SetTitle("MEU in ADCs vs Plane");
01528   pMeuAdcVsPlane1->GetXaxis()->SetTitle("Plane");
01529   pMeuAdcVsPlane1->GetXaxis()->CenterTitle();
01530   pMeuAdcVsPlane1->GetYaxis()->SetTitle("MEU");
01531   pMeuAdcVsPlane1->GetYaxis()->CenterTitle();
01532   cMeuVsPlane1->cd(2);
01533   TProfile* pMeuSigLinVsPlane1=new TProfile("pMeuSigLinVsPlane1",
01534                                             "pMeuSigLinVsPlane1",
01535                                             486,0,486);
01536   this->TProfileFill(pMeuSigLinVsPlane1,vWinPl,vMeuSigLin);
01537   pMeuSigLinVsPlane1->Draw();
01538   pMeuSigLinVsPlane1->SetTitle("MEU in Gain Corrected ADCs (like PEs) vs Plane");
01539   pMeuSigLinVsPlane1->GetXaxis()->SetTitle("Plane");
01540   pMeuSigLinVsPlane1->GetXaxis()->CenterTitle();
01541   pMeuSigLinVsPlane1->GetYaxis()->SetTitle("MEU");
01542   pMeuSigLinVsPlane1->GetYaxis()->CenterTitle();
01543   cMeuVsPlane1->cd(3);
01544   TProfile* pMeuSigCorVsPlane1=new TProfile("pMeuSigCorVsPlane1",
01545                                             "pMeuSigCorVsPlane1",
01546                                             486,0,486);
01547   this->TProfileFill(pMeuSigCorVsPlane1,vWinPl,vMeuSigCor);
01548   pMeuSigCorVsPlane1->Draw();
01549   pMeuSigCorVsPlane1->SetTitle("MEU in Strip to Strip Corrected ADCs (SigCors) vs Plane");
01550   pMeuSigCorVsPlane1->GetXaxis()->SetTitle("Plane");
01551   pMeuSigCorVsPlane1->GetXaxis()->CenterTitle();
01552   pMeuSigCorVsPlane1->GetYaxis()->SetTitle("MEU");
01553   pMeuSigCorVsPlane1->GetYaxis()->CenterTitle();
01554   cMeuVsPlane1->cd(4);
01555   TProfile* pMeuSigMapVsPlane1=new TProfile("pMeuSigMapVsPlane1",
01556                                             "pMeuSigMapVsPlane1",
01557                                             486,0,486);
01558   this->TProfileFill(pMeuSigMapVsPlane1,vWinPl,vMeuSigMap);
01559   pMeuSigMapVsPlane1->Draw();
01560   pMeuSigMapVsPlane1->SetTitle("MEU in Attenuation Corrected ADCs (SigMaps) vs Plane");
01561   pMeuSigMapVsPlane1->GetXaxis()->SetTitle("Plane");
01562   pMeuSigMapVsPlane1->GetXaxis()->CenterTitle();
01563   pMeuSigMapVsPlane1->GetYaxis()->SetTitle("MEU");
01564   pMeuSigMapVsPlane1->GetYaxis()->CenterTitle();
01565 
01566   cout<<"Drawing plots..."<<endl;
01570   TCanvas *cYvsX=new TCanvas("cYvsX","cYvsX",0,0,1000,1000);
01571   cYvsX->SetFillColor(0);
01572   cYvsX->Divide(1,2);
01573   cYvsX->cd(1);
01574   hYvsXWinVtxSide->Draw("colz");
01575   cYvsX->cd(2);
01576   hYvsXWinStopSide->Draw("colz");
01577 
01578   /*
01582 TCanvas *cYvsX=new TCanvas("cYvsX","cYvsX",0,0,1000,1000);
01583 cYvsX->SetFillColor(0);
01584 cYvsX->Divide(3,2);
01585 cYvsX->cd(1);
01586 TGraph* gWinVtxSideYvsX=this->TGraphVect(vWinVtxSideX,vWinVtxSideY);
01587 if (gWinVtxSideYvsX){
01588 gWinVtxSideYvsX->Draw("ap");
01589 gWinVtxSideYvsX->SetMarkerStyle(3);
01590 gWinVtxSideYvsX->SetMarkerColor(3);
01591 gWinVtxSideYvsX->SetMarkerSize(1);
01592 gWinVtxSideYvsX->SetTitle("Position of Window (Vtx Side)");
01593 gWinVtxSideYvsX->GetXaxis()->SetTitle("X (m)");
01594 gWinVtxSideYvsX->GetXaxis()->CenterTitle();
01595 gWinVtxSideYvsX->GetYaxis()->SetTitle("Y (m)");
01596 gWinVtxSideYvsX->GetYaxis()->CenterTitle();
01597 gWinVtxSideYvsX->Write("gWinVtxSideYvsX");
01598 }
01599 cYvsX->cd(2);
01600 hYvsXWinVtxSide->Draw("colz");
01601 cYvsX->cd(3);
01602 Int_t nYvsXBins=static_cast<Int_t>((vWinVtxSideX.size()/600)+1);
01603 TProfile2D* pMeuAsYvsX=new TProfile2D("pMeuAsYvsX","pMeuAsYvsX",
01604 nYvsXBins,-4,4,nYvsXBins,-4,4);
01605 this->TProfile2DFill(pMeuAsYvsX,vWinVtxSideX,vWinVtxSideY,vMeuYvsX);
01606 pMeuAsYvsX->Draw("colz");
01607 fS="2D Profile of MEU in "+sCalType+" (Vtx Side)";
01608 pMeuAsYvsX->SetTitle(fS.c_str());
01609 pMeuAsYvsX->GetXaxis()->SetTitle("X (m)");
01610 pMeuAsYvsX->GetXaxis()->CenterTitle();
01611 pMeuAsYvsX->GetYaxis()->SetTitle("Y (m)");
01612 pMeuAsYvsX->GetYaxis()->CenterTitle();
01613 cYvsX->cd(4);
01614 TGraph* gWinStopSideYvsX=this->TGraphVect(vWinStopSideX,vWinStopSideY);
01615 if (gWinStopSideYvsX){
01616 gWinStopSideYvsX->Draw("ap");
01617 gWinStopSideYvsX->SetMarkerStyle(3);
01618 gWinStopSideYvsX->SetMarkerColor(3);
01619 gWinStopSideYvsX->SetMarkerSize(1);
01620 gWinStopSideYvsX->SetTitle("Position of Window (Stop Side)");
01621 gWinStopSideYvsX->GetXaxis()->SetTitle("X (m)");
01622 gWinStopSideYvsX->GetXaxis()->CenterTitle();
01623 gWinStopSideYvsX->GetYaxis()->SetTitle("Y (m)");
01624 gWinStopSideYvsX->GetYaxis()->CenterTitle();
01625 gWinStopSideYvsX->Write("gWinStopSideYvsX");
01626 }
01627 cYvsX->cd(5);
01628 hYvsXWinStopSide->Draw("colz");
01629 cYvsX->cd(6);
01630 TProfile2D* pMeuAsYvsXS=new TProfile2D("pMeuAsYvsXS","pMeuAsYvsXS",
01631 nYvsXBins,-4,4,nYvsXBins,-4,4);
01632 this->TProfile2DFill(pMeuAsYvsXS,vWinStopSideX,vWinStopSideY,
01633 vMeuYvsX);
01634 pMeuAsYvsXS->Draw("colz");
01635 fS="2D Profile of MEU in "+sCalType+" (Stop Side)";
01636 pMeuAsYvsXS->SetTitle(fS.c_str());
01637 pMeuAsYvsXS->GetXaxis()->SetTitle("X (m)");
01638 pMeuAsYvsXS->GetXaxis()->CenterTitle();
01639 pMeuAsYvsXS->GetYaxis()->SetTitle("Y (m)");
01640 pMeuAsYvsXS->GetYaxis()->CenterTitle();
01641   */
01642 
01646   TCanvas *cStrip=new TCanvas("cStrip","cStrip",0,0,1000,1000);
01647   cStrip->SetFillColor(0);
01648   cStrip->Divide(2,2);
01649   cStrip->cd(1);
01650   TGraph* gMeuVsStripV2=this->TGraphVect(vWinVtxSideStripV2,vMeuV2);
01651   if (gMeuVsStripV2){
01652     gMeuVsStripV2->Draw("ap");
01653     gMeuVsStripV2->SetMarkerStyle(3);
01654     gMeuVsStripV2->SetMarkerColor(3);
01655     gMeuVsStripV2->SetMarkerSize(1);
01656     fS="MEU in "+sCalType+" vs Strip (Window Vtx Side, U-View)";
01657     gMeuVsStripV2->SetTitle(fS.c_str());
01658     gMeuVsStripV2->GetXaxis()->SetTitle("Strip");
01659     gMeuVsStripV2->GetXaxis()->CenterTitle();
01660     gMeuVsStripV2->GetYaxis()->SetTitle("MEU");
01661     gMeuVsStripV2->GetYaxis()->CenterTitle();
01662     gMeuVsStripV2->Write("gMeuVsStripV2");
01663   }
01664   cStrip->cd(3);
01665   Int_t nStripBinsV2=static_cast<Int_t>((vMeuV2.size()/600)+1);
01666   TProfile* pMeuVsStripV2=new TProfile("pMeuVsStripV2",
01667                                        "pMeuVsStripV2",
01668                                        nStripBinsV2,0,192);
01669   this->TProfileFill(pMeuVsStripV2,vWinVtxSideStripV2,vMeuV2);
01670   pMeuVsStripV2->Draw();
01671   fS="MEU in "+sCalType+" vs Strip (Window Vtx Side, U-View)";
01672   pMeuVsStripV2->SetTitle(fS.c_str());
01673   pMeuVsStripV2->GetXaxis()->SetTitle("Strip");
01674   pMeuVsStripV2->GetXaxis()->CenterTitle();
01675   pMeuVsStripV2->GetYaxis()->SetTitle("MEU");
01676   pMeuVsStripV2->GetYaxis()->CenterTitle();
01677   cStrip->cd(2);
01678   TGraph* gMeuVsStripV3=this->TGraphVect(vWinVtxSideStripV3,vMeuV3);
01679   if (gMeuVsStripV3){
01680     gMeuVsStripV3->Draw("ap");
01681     gMeuVsStripV3->SetMarkerStyle(3);
01682     gMeuVsStripV3->SetMarkerColor(3);
01683     gMeuVsStripV3->SetMarkerSize(1);
01684     fS="MEU in "+sCalType+" vs Strip (Window Vtx Side, V-View)";
01685     gMeuVsStripV3->SetTitle(fS.c_str());
01686     gMeuVsStripV3->GetXaxis()->SetTitle("Strip");
01687     gMeuVsStripV3->GetXaxis()->CenterTitle();
01688     gMeuVsStripV3->GetYaxis()->SetTitle("MEU");
01689     gMeuVsStripV3->GetYaxis()->CenterTitle();
01690     gMeuVsStripV3->Write("gMeuVsStripV3");
01691   }
01692   cStrip->cd(4);
01693   Int_t nStripBinsV3=static_cast<Int_t>((vMeuV3.size()/600)+1);
01694   TProfile* pMeuVsStripV3=new TProfile("pMeuVsStripV3",
01695                                        "pMeuVsStripV3",
01696                                        nStripBinsV3,0,192);
01697   this->TProfileFill(pMeuVsStripV3,vWinVtxSideStripV3,vMeuV3);
01698   pMeuVsStripV3->Draw();
01699   fS="MEU in "+sCalType+" vs Strip (Window Vtx Side, V-View)";
01700   pMeuVsStripV3->SetTitle(fS.c_str());
01701   pMeuVsStripV3->GetXaxis()->SetTitle("Strip");
01702   pMeuVsStripV3->GetXaxis()->CenterTitle();
01703   pMeuVsStripV3->GetYaxis()->SetTitle("MEU");
01704   pMeuVsStripV3->GetYaxis()->CenterTitle();
01705 
01706   cout<<"Drawing plots..."<<endl;
01710   TCanvas *cTPosLPos=new TCanvas("cTPosLPos","cTPosLPos",0,0,1000,1000);
01711   cTPosLPos->SetFillColor(0);
01712   cTPosLPos->Divide(2,4);
01713   cTPosLPos->cd(1);
01714   TGraph* gMeuVsTPosV2=this->TGraphVect(vWinVtxSideTPosV2,vMeuV2);
01715   if (gMeuVsTPosV2){
01716     gMeuVsTPosV2->Draw("ap");
01717     gMeuVsTPosV2->SetMarkerStyle(3);
01718     gMeuVsTPosV2->SetMarkerColor(3);
01719     gMeuVsTPosV2->SetMarkerSize(1);
01720     fS="MEU in "+sCalType+" vs Window TPos (U-View)";
01721     gMeuVsTPosV2->SetTitle(fS.c_str());
01722     gMeuVsTPosV2->GetXaxis()->SetTitle("TPos");
01723     gMeuVsTPosV2->GetXaxis()->CenterTitle();
01724     gMeuVsTPosV2->GetYaxis()->SetTitle("MEU");
01725     gMeuVsTPosV2->GetYaxis()->CenterTitle();
01726     gMeuVsTPosV2->Write("gMeuVsTPosV2");
01727   }
01728   cTPosLPos->cd(3);
01729   Int_t nTPosBinsV2=static_cast<Int_t>((vMeuV2.size()/600)+1);
01730   TProfile* pMeuVsTPosV2=new TProfile("pMeuVsTPosV2",
01731                                       "pMeuVsTPosV2",
01732                                       nTPosBinsV2,-4,4);
01733   this->TProfileFill(pMeuVsTPosV2,vWinVtxSideTPosV2,vMeuV2);
01734   pMeuVsTPosV2->Draw();
01735   fS="MEU in "+sCalType+" vs Window TPos (U-View)";
01736   pMeuVsTPosV2->SetTitle(fS.c_str());
01737   pMeuVsTPosV2->GetXaxis()->SetTitle("TPos");
01738   pMeuVsTPosV2->GetXaxis()->CenterTitle();
01739   pMeuVsTPosV2->GetYaxis()->SetTitle("MEU");
01740   pMeuVsTPosV2->GetYaxis()->CenterTitle();
01741   cTPosLPos->cd(2);
01742   TGraph* gMeuVsLPosV2=this->TGraphVect(vWinVtxSideLPosV2,vMeuV2);
01743   if (gMeuVsLPosV2){
01744     gMeuVsLPosV2->Draw("ap");
01745     gMeuVsLPosV2->SetMarkerStyle(3);
01746     gMeuVsLPosV2->SetMarkerColor(3);
01747     gMeuVsLPosV2->SetMarkerSize(1);
01748     fS="MEU in "+sCalType+" vs Window LPos (U-View)";
01749     gMeuVsLPosV2->SetTitle(fS.c_str());
01750     gMeuVsLPosV2->GetXaxis()->SetTitle("LPos");
01751     gMeuVsLPosV2->GetXaxis()->CenterTitle();
01752     gMeuVsLPosV2->GetYaxis()->SetTitle("MEU");
01753     gMeuVsLPosV2->GetYaxis()->CenterTitle();
01754     gMeuVsLPosV2->Write("gMeuVsLPosV2");
01755   }
01756   cTPosLPos->cd(4);
01757   TProfile* pMeuVsLPosV2=new TProfile("pMeuVsLPosV2",
01758                                       "pMeuVsLPosV2",
01759                                       nTPosBinsV2,-4,4);
01760   this->TProfileFill(pMeuVsLPosV2,vWinVtxSideLPosV2,vMeuV2);
01761   pMeuVsLPosV2->Draw();
01762   fS="MEU in "+sCalType+" vs Window LPos (U-View)";
01763   pMeuVsLPosV2->SetTitle(fS.c_str());
01764   pMeuVsLPosV2->GetXaxis()->SetTitle("LPos");
01765   pMeuVsLPosV2->GetXaxis()->CenterTitle();
01766   pMeuVsLPosV2->GetYaxis()->SetTitle("MEU");
01767   pMeuVsLPosV2->GetYaxis()->CenterTitle();
01768   //now do the v-view
01769   cTPosLPos->cd(5);
01770   TGraph* gMeuVsTPosV3=this->TGraphVect(vWinVtxSideTPosV3,vMeuV3);
01771   if (gMeuVsTPosV3){
01772     gMeuVsTPosV3->Draw("ap");
01773     gMeuVsTPosV3->SetMarkerStyle(3);
01774     gMeuVsTPosV3->SetMarkerColor(3);
01775     gMeuVsTPosV3->SetMarkerSize(1);
01776     fS="MEU in "+sCalType+" vs Window TPos (V-View)";
01777     gMeuVsTPosV3->SetTitle(fS.c_str());
01778     gMeuVsTPosV3->GetXaxis()->SetTitle("TPos");
01779     gMeuVsTPosV3->GetXaxis()->CenterTitle();
01780     gMeuVsTPosV3->GetYaxis()->SetTitle("MEU");
01781     gMeuVsTPosV3->GetYaxis()->CenterTitle();
01782     gMeuVsTPosV3->Write("gMeuVsTPosV3");
01783   }
01784   cTPosLPos->cd(7);
01785   Int_t nTPosBinsV3=static_cast<Int_t>((vMeuV3.size()/600)+1);
01786   TProfile* pMeuVsTPosV3=new TProfile("pMeuVsTPosV3",
01787                                       "pMeuVsTPosV3",
01788                                       nTPosBinsV3,-4,4);
01789   this->TProfileFill(pMeuVsTPosV3,vWinVtxSideTPosV3,vMeuV3);
01790   pMeuVsTPosV3->Draw();
01791   fS="MEU in "+sCalType+" vs Window TPos (V-View)";
01792   pMeuVsTPosV3->SetTitle(fS.c_str());
01793   pMeuVsTPosV3->GetXaxis()->SetTitle("TPos");
01794   pMeuVsTPosV3->GetXaxis()->CenterTitle();
01795   pMeuVsTPosV3->GetYaxis()->SetTitle("MEU");
01796   pMeuVsTPosV3->GetYaxis()->CenterTitle();
01797   cTPosLPos->cd(6);
01798   TGraph* gMeuVsLPosV3=this->TGraphVect(vWinVtxSideLPosV3,vMeuV3);
01799   if (gMeuVsLPosV3){
01800     gMeuVsLPosV3->Draw("ap");
01801     gMeuVsLPosV3->SetMarkerStyle(3);
01802     gMeuVsLPosV3->SetMarkerColor(3);
01803     gMeuVsLPosV3->SetMarkerSize(1);
01804     fS="MEU in "+sCalType+" vs Window LPos (V-View)";
01805     gMeuVsLPosV3->SetTitle(fS.c_str());
01806     gMeuVsLPosV3->GetXaxis()->SetTitle("LPos");
01807     gMeuVsLPosV3->GetXaxis()->CenterTitle();
01808     gMeuVsLPosV3->GetYaxis()->SetTitle("MEU");
01809     gMeuVsLPosV3->GetYaxis()->CenterTitle();
01810     gMeuVsLPosV3->Write("gMeuVsLPosV3");
01811   }
01812   cTPosLPos->cd(8);
01813   TProfile* pMeuVsLPosV3=new TProfile("pMeuVsLPosV3",
01814                                       "pMeuVsLPosV3",
01815                                       nTPosBinsV3,-4,4);
01816   this->TProfileFill(pMeuVsLPosV3,vWinVtxSideLPosV3,vMeuV3);
01817   pMeuVsLPosV3->Draw();
01818   fS="MEU in "+sCalType+" vs Window LPos (V-View)";
01819   pMeuVsLPosV3->SetTitle(fS.c_str());
01820   pMeuVsLPosV3->GetXaxis()->SetTitle("LPos");
01821   pMeuVsLPosV3->GetXaxis()->CenterTitle();
01822   pMeuVsLPosV3->GetYaxis()->SetTitle("MEU");
01823   pMeuVsLPosV3->GetYaxis()->CenterTitle();
01824 
01828   TCanvas* cAnglesY=new TCanvas("cAnglesY","cAnglesY",0,0,1100,1100);
01829   cAnglesY->SetFillColor(0);
01830   cAnglesY->Divide(1,2);
01831   cAnglesY->cd(1);
01832   Int_t nBinsTheta=static_cast<Int_t>((vMeuSigMap.size()/300)+1);
01833   TProfile* pThetaY=new TProfile("pThetaY","pThetaY",
01834                                  nBinsTheta,-1,1);
01835   this->TProfileFill(pThetaY,vWinCosThetaY,vMeuSigMap);
01836   pThetaY->Draw();
01837   pThetaY->SetTitle("MEU vs Cos(#theta_{Y})");
01838   pThetaY->GetXaxis()->SetTitle("Cos(#theta_{Y})");
01839   pThetaY->GetXaxis()->CenterTitle();
01840   pThetaY->GetYaxis()->SetTitle("MEU");
01841   pThetaY->GetYaxis()->CenterTitle();
01842   pThetaY->SetLineColor(2);
01843   pThetaY->SetFillColor(0);
01844   pThetaY->SetMinimum(600);
01845   pThetaY->SetMaximum(1000);
01846   cAnglesY->cd(2);
01847   hThetaY->Draw();
01848 
01849   cout<<"Drawing plots..."<<endl;
01853   TCanvas* cAnglesZ=new TCanvas("cAnglesZ","cAnglesZ",0,0,1100,1100);
01854   cAnglesZ->SetFillColor(0);
01855   cAnglesZ->Divide(1,2);
01856   cAnglesZ->cd(1);
01857   TProfile* pThetaZ=new TProfile("pThetaZ","pThetaZ",
01858                                  nBinsTheta,-1,1);
01859   this->TProfileFill(pThetaZ,vWinCosThetaZ,vMeuSigMap);
01860   pThetaZ->Draw();
01861   pThetaZ->SetTitle("MEU vs Cos(#theta_{Z})");
01862   pThetaZ->GetXaxis()->SetTitle("Cos(#theta_{Z})");
01863   pThetaZ->GetXaxis()->CenterTitle();
01864   pThetaZ->GetYaxis()->SetTitle("MEU");
01865   pThetaZ->GetYaxis()->CenterTitle();
01866   pThetaZ->SetLineColor(2);
01867   pThetaZ->SetFillColor(0);
01868   pThetaZ->SetMinimum(600);
01869   pThetaZ->SetMaximum(1000);
01870   cAnglesZ->cd(2);
01871   hThetaZ->Draw();
01872 
01873   Double_t quantile=0.5;//quantile to compute
01874   Double_t meu=-1;
01875   hWinSigMap->GetQuantiles(1,&meu,&quantile);
01876 
01877   cout<<"Median="<<meu
01878       <<", mean="<<hWinSigMap->GetMean()
01879     //<<" +/- "<<hWinSigMap->GetRMS()/sqrt(hWinSigMap->GetEntries())
01880       <<", entries="<<hWinSigMap->GetEntries()
01881       <<endl;
01882 
01883 
01884   MSG("MeuPlots",Msg::kInfo) 
01885     <<" ** Finished MeuSystematics method **"<<endl;
01886 }

void MeuPlots::NormaliseVector ( std::vector< Double_t > &  v,
Int_t  mode = 1 
) const [private]

Definition at line 900 of file MeuPlots.cxx.

References Msg::kDebug, Msg::kInfo, Msg::kVerbose, and MSG.

00901 {
00902   MSG("MeuPlots",Msg::kDebug) 
00903     <<" ** Running NormaliseVector method... **"<<endl;
00904   
00905   if (v.size()>0){
00906 
00907     if (mode==1){//simple average
00908       //find average
00909       Double_t average=0;
00910       for (UInt_t i=0;i<v.size();i++) average+=v[i];
00911       average/=v.size();
00912       
00913       MSG("MeuPlots",Msg::kVerbose)<<"Average="<<average<<endl; 
00914       
00915       //normalise
00916       for (UInt_t i=0;i<v.size();i++) v[i]/=average;
00917     }
00918     else if (mode==2){//fit the function to remove effect of outliers
00919       
00920       Double_t vMax=-9e50;
00921       Double_t vMin=9e50;
00922 
00923       //work out mins and maxs
00924       for (UInt_t i=0;i<v.size();i++){
00925         if (v[i]>vMax) vMax=v[i];
00926         if (v[i]<vMin) vMin=v[i];
00927       }
00928       
00929       //limit the number of bins
00930       Int_t numBins=300;
00931       if (4*v.size()<10000) numBins=4*v.size();
00932 
00933       MSG("MeuPlots",Msg::kInfo)
00934         <<"vMax="<<vMax <<", vMin="<<vMin<<", numBins="<<numBins<<endl;
00935 
00936       //create the histo
00937       TH1F* h=new TH1F("h","h",numBins,vMin-abs(0.1*vMin),
00938                        vMax+abs(0.1*vMin));
00939       h->SetBit(TH1::kCanRebin);
00940 
00941       Double_t average=0;
00942       for (UInt_t i=0;i<v.size();i++){
00943         //find average
00944         average+=v[i];
00945 
00946         //fill the histo
00947         h->Fill(v[i]);
00948       }
00949       average/=v.size();
00950 
00951       //fit but use 0 (zero!) otherwise it stamps on the current canvas!
00952       h->Fit("gaus","q0");
00953       TF1* func=h->GetFunction("gaus");
00954       Double_t p1=func->GetParameter(1);
00955       Double_t p2=func->GetParameter(2);
00956 
00957       //don't use the fit if it is screwed up
00958       Double_t avToNormWith=p1;
00959       if (p1<vMin || p1>vMax) avToNormWith=average;
00960 
00961       MSG("MeuPlots",Msg::kInfo)
00962         <<"Fitted mean="<<p1
00963         <<" (average="<<average
00964         <<") fitted rms="<<p2
00965         <<", using avToNormWith="<<avToNormWith<<endl;
00966 
00967       //normalise
00968       for (UInt_t i=0;i<v.size();i++) v[i]/=avToNormWith;
00969 
00970       delete h;
00971     }
00972   }
00973 
00974   MSG("MeuPlots",Msg::kDebug) 
00975     <<" ** Finished NormaliseVector method **"<<endl;
00976 }

TFile* MeuPlots::OpenFile ( Int_t  runNumber,
std::string  prefix = "" 
) [private]
Int_t MeuPlots::Rnd ( Double_t  x  )  const

Definition at line 1009 of file MeuPlots.cxx.

01010 {
01011   Double_t xi=0;
01012 
01013   Double_t floatPart=modf(x,&xi); 
01014 
01015   //round up if necessary
01016   if (floatPart>0.5) xi++;
01017 
01018   return static_cast<Int_t>(xi);
01019 }

void MeuPlots::ScaleMap ( std::map< Int_t, Float_t > &  m,
const std::map< Int_t, Float_t > &  scaleFactor 
) const [private]

Definition at line 1023 of file MeuPlots.cxx.

References Msg::kDebug, Msg::kVerbose, Msg::kWarning, and MSG.

01025 {
01026   MSG("MeuPlots",Msg::kDebug) 
01027     <<" ** Running ScaleMap method... **"<<endl;
01028 
01029   if (m.size()==scaleFactor.size()){
01030     
01031     map<Int_t,Float_t>::iterator mIter=m.begin();
01032     map<Int_t,Float_t>::const_iterator scale=scaleFactor.begin();
01033 
01034     //loop over map and scale it
01035     while (mIter!=m.end()){
01036 
01037       //divide by the scale factor
01038       if (scale->second!=0){
01039         MSG("MeuPlots",Msg::kVerbose)
01040           <<"mIter="<<mIter->second<<", scale="<<scale->second<<endl;
01041         mIter->second/=scale->second;
01042       }
01043       else MSG("MeuPlots",Msg::kWarning)<<"Scale factor zero!"<<endl;
01044 
01045       mIter++;
01046       scale++;
01047     }
01048   }
01049   else{
01050     MSG("MeuPlots",Msg::kWarning)
01051       <<"Not scaling map, vectors are different sizes!"<<endl;
01052   }
01053 
01054   MSG("MeuPlots",Msg::kDebug) 
01055     <<" ** Finished ScaleMap method **"<<endl;
01056 }

void MeuPlots::ScaleVector ( std::vector< Double_t > &  v,
Double_t  scaleFactor 
) const [private]

Definition at line 980 of file MeuPlots.cxx.

References Msg::kDebug, and MSG.

Referenced by MakeValidationPlots().

00982 {
00983   MSG("MeuPlots",Msg::kDebug) 
00984     <<" ** Running ScaleVector method... **"<<endl;
00985 
00986   for (UInt_t i=0;i<v.size();i++) v[i]*=scaleFactor;
00987 
00988   MSG("MeuPlots",Msg::kDebug) 
00989     <<" ** Finished ScaleVector method **"<<endl;
00990 }

void MeuPlots::SetGraphAxis ( TAxis *  a,
Int_t  startTimeSecs,
Int_t  endTimeSecs 
) const

Definition at line 511 of file MeuPlots.cxx.

References Form(), Msg::kInfo, Msg::kWarning, and MSG.

Referenced by MakeValidationPlots(), and MeuSystematics().

00513 {
00514   if (!a){
00515     MSG("MeuPlots",Msg::kWarning)
00516       <<"Input axis pointer is null! Will do nothing"<<endl;
00517     return;
00518   }
00519 
00520   //get datimes
00521   TDatime startDatime;
00522   startDatime.Set(startTimeSecs+788918400);
00523   TDatime endDatime;
00524   endDatime.Set(endTimeSecs+788918400);
00525 
00526   //play around with the formatting a little
00527   string sStartHour=Form("%d",startDatime.GetHour());
00528   string sStartMinute=Form("%d",startDatime.GetMinute());
00529   string sStartSecond=Form("%d",startDatime.GetSecond());
00530   string sStartYear=Form("%d",startDatime.GetYear());
00531   string sStartMonth=Form("%d",startDatime.GetMonth());
00532   string sStartDay=Form("%d",startDatime.GetDay());
00533   if (startDatime.GetHour()<10) sStartHour="0"+sStartHour;
00534   if (startDatime.GetMinute()<10) sStartMinute="0"+sStartMinute;
00535   if (startDatime.GetSecond()<10) sStartSecond="0"+sStartSecond;
00536   if (startDatime.GetMonth()<10) sStartMonth="0"+sStartMonth;
00537   if (startDatime.GetDay()<10) sStartDay="0"+sStartDay;
00538 
00539   //play around with the formatting a little
00540   string sEndHour=Form("%d",endDatime.GetHour());
00541   string sEndMinute=Form("%d",endDatime.GetMinute());
00542   string sEndSecond=Form("%d",endDatime.GetSecond());
00543   string sEndYear=Form("%d",endDatime.GetYear());
00544   string sEndMonth=Form("%d",endDatime.GetMonth());
00545   string sEndDay=Form("%d",endDatime.GetDay());
00546   if (endDatime.GetHour()<10) sEndHour="0"+sEndHour;
00547   if (endDatime.GetMinute()<10) sEndMinute="0"+sEndMinute;
00548   if (endDatime.GetSecond()<10) sEndSecond="0"+sEndSecond;
00549   if (endDatime.GetMonth()<10) sEndMonth="0"+sEndMonth;
00550   if (endDatime.GetDay()<10) sEndDay="0"+sEndDay;
00551 
00552   static Bool_t firstTime=true;
00553   if (firstTime){
00554     MSG("MeuPlots",Msg::kInfo) 
00555       <<"Setting axis info:"<<endl;
00556     MSG("MeuPlots",Msg::kInfo) 
00557       <<"  Start time "<<sStartHour
00558       <<":"<<sStartMinute
00559       <<":"<<sStartSecond
00560       <<" on "<<startDatime.GetYear()
00561       <<"/"<<sStartMonth
00562       <<"/"<<sStartDay
00563       <<endl;
00564 
00565     MSG("MeuPlots",Msg::kInfo) 
00566       <<"  End time   "<<sEndHour
00567       <<":"<<sEndMinute
00568       <<":"<<sEndSecond
00569       <<" on "<<endDatime.GetYear()
00570       <<"/"<<sEndMonth
00571       <<"/"<<sEndDay
00572       <<endl;
00573   }
00574 
00575   Int_t timeRange=endTimeSecs-startTimeSecs;
00576    
00577   if (sStartDay==sEndDay && timeRange<1*24*60*60){
00578     string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay+")";
00579     a->SetTitle(title.c_str());
00580     a->SetTimeFormat("%H:%M");
00581   }
00582   else if (timeRange>=1*24*60*60 && timeRange<2*24*60*60){//1-2 days
00583     string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00584       +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00585     a->SetTitle(title.c_str());
00586     a->SetTimeFormat("%H:%M");
00587   }
00588   else if (timeRange>=2*24*60*60 && timeRange<5*24*60*60){//2-5 days
00589     string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00590       +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00591     a->SetTitle(title.c_str());
00592     a->SetTimeFormat("%H:%M-%d/%m");
00593   }
00594   else if (timeRange>=5*24*60*60 && timeRange<20*24*60*60){//5-20 days
00595     string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00596       +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00597     a->SetTitle(title.c_str());
00598     a->SetTimeFormat("%d/%m");
00599   }
00600   else if (timeRange>=20*24*60*60 && timeRange<90*24*60*60){//20-90 days
00601     string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00602       +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00603     a->SetTitle(title.c_str());
00604     a->SetTimeFormat("%Y/%m/%d");
00605   }
00606   else if (timeRange>=90*24*60*60 && 
00607            timeRange<2*365*24*60*60){//50-2*365 days
00608     string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00609       +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00610     a->SetTitle(title.c_str());
00611     a->SetTimeFormat("%Y/%m");//Y for year with century
00612   }
00613   else if (timeRange>=2*365*24*60*60){// >2*365 days
00614     string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00615       +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00616     a->SetTitle(title.c_str());
00617     a->SetTimeFormat("%Y/%m");//Y for year with century
00618   }
00619   else{//shouldn't get used
00620     string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00621       +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00622     a->SetTitle(title.c_str());
00623     a->SetTimeFormat("%H:%M-%d/%m");
00624     //stop it cramming loads of days on the axis!
00625     a->SetNdivisions(506);
00626     //n = N1 + 100*N2 + 10000*N3
00627     //N1=number of primary divisions.
00628     //N2=number of secondary divisions.
00629     //N3=number of 3rd divisions.
00630   }
00631    
00632   //TDatime da(2003,02,28,12,00,00);
00633   //          gStyle->SetTimeOffset(da.Convert());
00634 
00635   if (firstTime) MSG("MeuPlots",Msg::kInfo) 
00636     <<"Set axis title to be '"<<a->GetTitle()<<"'"<<endl;
00637 
00638   //other x-axis defaults
00639   a->SetTimeDisplay(1);
00640   firstTime=false;
00641 }

void MeuPlots::SetGraphAxisEtc ( TGraph *  g,
Int_t  startTimeSecs,
Int_t  endTimeSecs 
) const

Definition at line 394 of file MeuPlots.cxx.

References Form(), Msg::kError, Msg::kInfo, Msg::kVerbose, and MSG.

00396 {
00397   MSG("MeuPlots",Msg::kVerbose)
00398     <<endl<<" ** Running the SetGraphAxisEtc method... ** "<<endl;
00399 
00400   TDatime startDatime;
00401   startDatime.Set(startTimeSecs+788918400);
00402   TDatime endDatime;
00403   endDatime.Set(endTimeSecs+788918400);
00404 
00405   //play around with the formatting a little
00406   string sStartHour=Form("%d",startDatime.GetHour());
00407   string sStartMinute=Form("%d",startDatime.GetMinute());
00408   string sStartSecond=Form("%d",startDatime.GetSecond());
00409   string sStartYear=Form("%d",startDatime.GetYear());
00410   string sStartMonth=Form("%d",startDatime.GetMonth());
00411   string sStartDay=Form("%d",startDatime.GetDay());
00412   if (startDatime.GetHour()<10) sStartHour="0"+sStartHour;
00413   if (startDatime.GetMinute()<10) sStartMinute="0"+sStartMinute;
00414   if (startDatime.GetSecond()<10) sStartSecond="0"+sStartSecond;
00415   if (startDatime.GetMonth()<10) sStartMonth="0"+sStartMonth;
00416   if (startDatime.GetDay()<10) sStartDay="0"+sStartDay;
00417 
00418   //play around with the formatting a little
00419   string sEndHour=Form("%d",endDatime.GetHour());
00420   string sEndMinute=Form("%d",endDatime.GetMinute());
00421   string sEndSecond=Form("%d",endDatime.GetSecond());
00422   string sEndYear=Form("%d",endDatime.GetYear());
00423   string sEndMonth=Form("%d",endDatime.GetMonth());
00424   string sEndDay=Form("%d",endDatime.GetDay());
00425   if (endDatime.GetHour()<10) sEndHour="0"+sEndHour;
00426   if (endDatime.GetMinute()<10) sEndMinute="0"+sEndMinute;
00427   if (endDatime.GetSecond()<10) sEndSecond="0"+sEndSecond;
00428   if (endDatime.GetMonth()<10) sEndMonth="0"+sEndMonth;
00429   if (endDatime.GetDay()<10) sEndDay="0"+sEndDay;
00430 
00431   static Bool_t firstTime=true;
00432   if (firstTime){
00433     MSG("LIAnalysis",Msg::kInfo) 
00434       <<"Setting graph axis info:"<<endl;
00435     MSG("LIAnalysis",Msg::kInfo) 
00436       <<"  Start time "<<sStartHour
00437       <<":"<<sStartMinute
00438       <<":"<<sStartSecond
00439       <<" on "<<startDatime.GetYear()
00440       <<"/"<<sStartMonth
00441       <<"/"<<sStartDay
00442       <<endl;
00443     
00444     MSG("LIAnalysis",Msg::kInfo) 
00445       <<"  End time "<<sEndHour
00446       <<":"<<sEndMinute
00447       <<":"<<sEndSecond
00448       <<" on "<<endDatime.GetYear()
00449       <<"/"<<sEndMonth
00450       <<"/"<<sEndDay
00451       <<endl;
00452   }
00453   firstTime=false;
00454 
00455   Int_t timeRange=endTimeSecs-startTimeSecs;
00456 
00457   //check graph pointer is not null
00458   if (g){
00459     if (sStartDay==sEndDay && timeRange<1*24*60*60){
00460       string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay+")";
00461       g->GetXaxis()->SetTitle(title.c_str());
00462       g->GetXaxis()->SetTimeFormat("%H:%M");
00463     }
00464     else if (timeRange>1*24*60*60 && timeRange<2*24*60*60){//1-2 days
00465       string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00466         +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00467       g->GetXaxis()->SetTitle(title.c_str());
00468       g->GetXaxis()->SetTimeFormat("%H:%M");
00469     }
00470     else if (timeRange>2*24*60*60 && timeRange<5*24*60*60){//2-5 days
00471       string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00472         +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00473       g->GetXaxis()->SetTitle(title.c_str());
00474       g->GetXaxis()->SetTimeFormat("%H:%M-%d/%m");
00475     }
00476     else{
00477       string title="Time ("+sStartYear+"/"+sStartMonth+"/"+sStartDay
00478         +" - "+sEndYear+"/"+sEndMonth+"/"+sEndDay+")";
00479       g->GetXaxis()->SetTitle(title.c_str());
00480       g->GetXaxis()->SetTimeFormat("%H:%M-%d/%m");
00481       //stop it cramming loads of days on the axis!
00482       g->GetXaxis()->SetNdivisions(506);
00483       //n = N1 + 100*N2 + 10000*N3
00484       //N1=number of primary divisions.
00485       //N2=number of secondary divisions.
00486       //N3=number of 3rd divisions.
00487     }
00488     
00489     //other x-axis defaults
00490     g->GetXaxis()->SetTimeDisplay(1);
00491     g->GetXaxis()->CenterTitle();
00492     
00493     //other defaults
00494     g->SetMarkerStyle(3);
00495     g->SetMarkerColor(2);
00496     g->SetMarkerSize(0.35);
00497     g->SetLineColor(46);
00498   }
00499   else{
00500     MSG("MeuPlots",Msg::kError)
00501       <<"Input graph pointer is null!"
00502       <<" Will do nothing."<<endl;
00503   }
00504 
00505   MSG("MeuPlots",Msg::kVerbose)
00506     <<endl<<" ** Finished the SetGraphAxisEtc method... **"<<endl;
00507 }

void MeuPlots::SetLoopVariables ( Int_t  entry,
Int_t  printMode = 1 
) [private]

Definition at line 107 of file MeuPlots.cxx.

References fChain, fEntries, Msg::kInfo, and MSG.

Referenced by FNALSep04(), MakeValidationPlots(), and MeuSystematics().

00108 {
00109   if (printMode==1){
00110     Float_t fract=ceil(fEntries/20.);  
00111     if (ceil(((Float_t)entry)/fract)==((Float_t)entry)/fract){
00112       MSG("MeuPlots",Msg::kInfo) 
00113         <<"Fraction of loop complete: "<<entry 
00114         <<"/"<<fEntries<<"  ("
00115         <<(Int_t)(100.*entry/fEntries)<<"%)"<<endl;
00116     }
00117   }
00118 
00119   //get the snarl/entry
00120   fChain->GetEntry(entry); 
00121 
00122   //initialise snarl level variables
00123 
00124 }

void MeuPlots::SetRootFileObjects (  )  [private]

Definition at line 306 of file MeuPlots.cxx.

References fChain, fEntries, fMeuSummary, fRunNumber, Msg::kDebug, Msg::kInfo, MSG, and MeuSummary::Run.

Referenced by MeuPlots().

00307 {
00308   MSG("MeuPlots",Msg::kDebug)
00309     <<"Running the SetRootFileObjects method..."<<endl;
00310 
00311   //set up tree
00312   fChain->SetBranchAddress("s",&fMeuSummary);
00313 
00314   //set the number of entries in the tree
00315   fEntries=static_cast<Int_t>(fChain->GetEntries());
00316   MSG("MeuPlots",Msg::kInfo)
00317     <<"MeuSummary tree has "<<fEntries<<" entries"<<endl;
00318   if (fEntries>0){
00319     //get the snarl/entry
00320     fChain->GetEntry(0); 
00321     fRunNumber=fMeuSummary->Run;
00322     MSG("MeuPlots",Msg::kInfo)
00323       <<"First run number="<<fRunNumber<<endl;
00324   }
00325 
00326   MSG("MeuPlots",Msg::kDebug)
00327     <<"Finished the SetRootFileObjects method"<<endl;
00328 }

TGraph * MeuPlots::TGraphMap ( const std::map< Int_t, Float_t > &  m  )  const

Definition at line 875 of file MeuPlots.cxx.

References Munits::g, Msg::kDebug, and MSG.

00876 {
00877   MSG("MeuPlots",Msg::kDebug) 
00878     <<" ** Running TGraphMap method... **"<<endl;
00879 
00880   TGraph* g=new TGraph(m.size());
00881 
00882   map<Int_t,Float_t>::const_iterator mIter=m.begin();
00883 
00884   Int_t i=0;
00885 
00886   while (mIter!=m.end()){
00887     g->SetPoint(i,mIter->first,mIter->second);
00888 
00889     i++;
00890     mIter++;
00891   }
00892 
00893   MSG("MeuPlots",Msg::kDebug) 
00894     <<" ** Finished TGraphMap method **"<<endl;
00895   return g;
00896 }

void MeuPlots::TGraphMinMax ( std::vector< TGraph * > &  v  )  const
void MeuPlots::TGraphOffset ( std::vector< TGraph * > &  v,
Double_t  factor = 1 
) const

Definition at line 789 of file MeuPlots.cxx.

References Msg::kDebug, Msg::kVerbose, max, min, and MSG.

00791 {
00792   Double_t max=-1e200;
00793   Double_t min=+1e200;
00794 
00795   //find the min and max
00796   for (vector<TGraph*>::iterator vIt=v.begin();vIt!=v.end();++vIt){
00797     for (Int_t i=0;i<(*vIt)->GetN();i++){
00798       Double_t x=0;
00799       Double_t y=0;
00800       (*vIt)->GetPoint(i,x,y);
00801       MSG("MeuPlots",Msg::kVerbose)
00802         <<"i="<<i<<", x="<<x<<", y="<<y<<endl;
00803 
00804       //find the min and max
00805       if (y>max) max=y;
00806       if (y<min) min=y;
00807     }
00808   }
00809 
00810   //change the scale
00811   for (vector<TGraph*>::iterator vIt=v.begin();vIt!=v.end();++vIt){
00812     for (Int_t i=0;i<(*vIt)->GetN();i++){
00813       Double_t x=0;
00814       Double_t y=0;
00815       (*vIt)->GetPoint(i,x,y);
00816       MSG("MeuPlots",Msg::kVerbose)
00817         <<"i="<<i<<", x="<<x<<", y="<<y<<endl;
00818 
00819       //scale the y value
00820       y-=min;
00821       y*=factor;//scale by factor, e.g. convert to nanosec
00822       (*vIt)->SetPoint(i,x,y);
00823     }
00824   }
00825 
00826   MSG("MeuPlots",Msg::kDebug)
00827     <<"Found min="<<min<<", max="<<max<<endl;
00828 
00829   //convert min and max
00830   max=(max-min)*factor;  
00831   min=(min-min)*factor;
00832   MSG("MeuPlots",Msg::kDebug)
00833     <<"Converted range to min="<<min<<", max="<<max<<endl;
00834   
00835   //now set the min and max for 10% above and below size of range
00836   for (vector<TGraph*>::iterator vIt=v.begin();vIt!=v.end();++vIt){
00837     (*vIt)->SetMinimum(min-0.1*(max-min));
00838     (*vIt)->SetMaximum(max+0.1*(max-min));
00839   }
00840 }

TGraph * MeuPlots::TGraphVect ( std::vector< Double_t > &  vX,
std::vector< Double_t > &  vY 
) const

Definition at line 757 of file MeuPlots.cxx.

References Munits::g, Msg::kDebug, Msg::kWarning, and MSG.

Referenced by MeuSystematics().

00759 {
00760   MSG("MeuPlots",Msg::kDebug) 
00761     <<" ** Running TGraphVect method... **"<<endl;
00762 
00763   if (vX.empty()) {
00764     MSG("MeuPlots",Msg::kWarning) 
00765       <<"TGraphVect: One or more vectors is empty"<<endl;
00766     return 0;
00767   }
00768 
00769   if (vX.size()!=vY.size()) {
00770     MSG("MeuPlots",Msg::kWarning) 
00771       <<"TGraphVect: vectors different sizes; returning..."<<endl;
00772     return 0;
00773   }
00774 
00775   TGraph* g=new TGraph(vX.size());
00776 
00777   UInt_t vSize=vX.size();
00778   for (UInt_t i=0;i<vSize;i++){
00779     g->SetPoint(i,vX[i],vY[i]);
00780   }
00781 
00782   MSG("MeuPlots",Msg::kDebug) 
00783     <<" ** Finished TGraphVect method **"<<endl;
00784   return g;
00785 }

void MeuPlots::TH1FFill ( TH1F *  h,
std::vector< Double_t > &  vX 
) const

Definition at line 645 of file MeuPlots.cxx.

References Msg::kWarning, and MSG.

Referenced by MakeValidationPlots().

00646 {
00647   if (vX.empty()) {
00648     MSG("MeuPlots",Msg::kWarning) 
00649       <<"One or more vectors is empty"<<endl;
00650     return;
00651   }
00652 
00653   if (!h){
00654     MSG("MeuPlots",Msg::kWarning) 
00655       <<"pointer==0"<<endl;
00656     return;
00657   }
00658 
00659   UInt_t vSize=vX.size();
00660   for (UInt_t i=0;i<vSize;i++){
00661     h->Fill(vX[i]);
00662   }
00663 }

void MeuPlots::TProfile2DFill ( TProfile2D *  p,
std::vector< Double_t > &  vX,
std::vector< Double_t > &  vY,
std::vector< Double_t > &  vZ 
) const

Definition at line 703 of file MeuPlots.cxx.

References Msg::kWarning, and MSG.

Referenced by FNALSep04().

00707 {
00708   if (vX.empty()) {
00709     MSG("MeuPlots",Msg::kWarning) 
00710       <<"FillTProfile2D: One or more vectors is empty"<<endl;
00711     return;
00712   }
00713 
00714   if (!p){
00715     MSG("MeuPlots",Msg::kWarning) 
00716       <<"FillTProfile2D: TProfile2D pointer==0"<<endl;
00717     return;
00718   }
00719 
00720   if (vX.size()!=vY.size() || vX.size()!=vZ.size()) {
00721     MSG("MeuPlots",Msg::kWarning) 
00722       <<"FillTProfile2D: vectors different sizes; returning..."<<endl;
00723     return;
00724   }
00725 
00726   UInt_t vSize=vX.size();
00727   for (UInt_t i=0;i<vSize;i++){
00728     p->Fill(vX[i],vY[i],vZ[i]);
00729   }
00730 }

void MeuPlots::TProfileFill ( TProfile *  p,
std::vector< Double_t > &  vX,
std::vector< Double_t > &  vY 
) const

Definition at line 667 of file MeuPlots.cxx.

References Msg::kDebug, Msg::kWarning, and MSG.

Referenced by FNALSep04(), MakeValidationPlots(), and MeuSystematics().

00670 {
00671   MSG("MeuPlots",Msg::kDebug) 
00672     <<" ** Running FillTProfile method... **"<<endl;
00673 
00674   if (vX.empty()) {
00675     MSG("MeuPlots",Msg::kWarning) 
00676       <<"FillTProfile: One or more vectors is empty"<<endl;
00677     return;
00678   }
00679 
00680   if (!p){
00681     MSG("MeuPlots",Msg::kWarning) 
00682       <<"FillTProfile: TProfile pointer==0"<<endl;
00683     return;
00684   }
00685 
00686   if (vX.size()!=vY.size()) {
00687     MSG("MeuPlots",Msg::kWarning) 
00688       <<"FillTProfile: vectors different sizes; returning..."<<endl;
00689     return;
00690   }
00691 
00692   UInt_t vSize=vX.size();
00693   for (UInt_t i=0;i<vSize;i++){
00694     p->Fill(vX[i],vY[i]);
00695   }
00696 
00697   MSG("MeuPlots",Msg::kDebug) 
00698     <<" ** Finished FillTProfile method **"<<endl;
00699 }

void MeuPlots::ugliClearFibre (  ) 

Definition at line 2711 of file MeuPlots.cxx.

References UgliStripHandle::ClearFiber(), Munits::g, UgliStripHandle::GetHalfLength(), PlaneOutline::GetOutline(), Calibrator::GetPhotoElectrons(), UgliPlnHandle::GetPlaneView(), UgliGeomHandle::GetScintPlnHandle(), UgliGeomHandle::GetStripHandle(), Calibrator::GetStripToStripCorrected(), UgliStripHandle::GetTPos(), UgliStripHandle::GlobalPos(), Calibrator::Instance(), StripEnd::kEast, Detector::kFar, Msg::kInfo, SimFlag::kMC, Detector::kNear, PlaneCoverage::kNearFull, PlaneCoverage::kNearPartial, PlaneView::kU, PlaneView::kV, StripEnd::kWest, StripEnd::kWhole, MAXMSG, VldContext::Print(), CalScheme::Reset(), and UgliStripHandle::WlsPigtail().

02712 {
02713   //JobC j;
02714   //j.Msg.SetLevel("Ugli","Info");
02715 
02716   //open the output file for the histograms
02717   //fOutFile=this->OpenFile(46,"FiberLengths");  
02718 
02719   //test values
02720   //Detector::Detector_t dt=Detector::kFar;
02721   Detector::Detector_t dt=Detector::kNear;
02722   VldTimeStamp* vldts=new VldTimeStamp(2005,11,14,0,0,1);
02723   //VldTimeStamp* vldts=new VldTimeStamp();
02724   //VldContext* vc=new VldContext(dt,SimFlag::kData,*vldts);//was this
02725   VldContext* vc=new VldContext(dt,SimFlag::kMC,*vldts);//new 2/Oct
02726 
02727   //get a calibrator
02728   Calibrator& cal=Calibrator::Instance();
02729   //reset the calibrator vc
02730   cal.Reset(*vc);
02731   //MuonDriftCalScheme::GetDriftCorrected
02732   //PlexStripEndId seid2(dt,100,25,StripEnd::kWest);
02733   //x=cal.GetDriftCorrected(x,seid2);
02734   
02735   cout<<"Using VldContext: ";
02736   vc->Print();
02737   cout<<endl;
02738 
02739 
02740   TH1F* hGainCorCalor=new TH1F("hGainCorCalor","hGainCorCalor",500,0,5);
02741   hGainCorCalor->SetTitle("Gain Correction Factor");
02742   hGainCorCalor->GetXaxis()->SetTitle("Gain Correction Factor");
02743   hGainCorCalor->GetXaxis()->CenterTitle();
02744   hGainCorCalor->GetYaxis()->SetTitle("");
02745   hGainCorCalor->GetYaxis()->CenterTitle();
02746   hGainCorCalor->SetLineColor(2);
02747   //hGainCorCalor->SetBit(TH1::kCanRebin);
02748 
02749   TH1F* hAttenGreenCorCalor=new TH1F("hAttenGreenCorCalor","hAttenGreenCorCalor",
02750                                 500,0,5);
02751   hAttenGreenCorCalor->SetTitle("Green Fiber Correction Factor");
02752   hAttenGreenCorCalor->GetXaxis()->SetTitle("Green Fiber Correction Factor");
02753   hAttenGreenCorCalor->GetXaxis()->CenterTitle();
02754   hAttenGreenCorCalor->GetYaxis()->SetTitle("");
02755   hAttenGreenCorCalor->GetYaxis()->CenterTitle();
02756   hAttenGreenCorCalor->SetLineColor(3);
02757   //hAttenGreenCorCalor->SetBit(TH1::kCanRebin);
02758   
02759   TH1F* hAttenCorCalor=new TH1F("hAttenCorCalor","hAttenCorCalor",
02760                            500,0,5);
02761   hAttenCorCalor->SetTitle("Clear Fiber Correction Factor");
02762   hAttenCorCalor->GetXaxis()->SetTitle("Clear Fiber Correction Factor");
02763   hAttenCorCalor->GetXaxis()->CenterTitle();
02764   hAttenCorCalor->GetYaxis()->SetTitle("");
02765   hAttenCorCalor->GetYaxis()->CenterTitle();
02766   hAttenCorCalor->SetLineColor(4);
02767   //hAttenCorCalor->SetBit(TH1::kCanRebin);
02768   
02769   TH1F* hTotalCorCalor=new TH1F("hTotalCorCalor","hTotalCorCalor",
02770                            500,0,5);
02771   hTotalCorCalor->SetTitle("Total Correction Factor");
02772   hTotalCorCalor->GetXaxis()->SetTitle("Total Correction Factor");
02773   hTotalCorCalor->GetXaxis()->CenterTitle();
02774   hTotalCorCalor->GetYaxis()->SetTitle("");
02775   hTotalCorCalor->GetYaxis()->CenterTitle();
02776   hTotalCorCalor->SetLineColor(1);
02777   //hTotalCorCalor->SetBit(TH1::kCanRebin);
02778   
02779   TH1F* hStsCorCalor=new TH1F("hStsCorCalor","hStsCorCalor",
02780                            500,0,5);
02781   hStsCorCalor->SetTitle("Sts Correction Factor");
02782   hStsCorCalor->GetXaxis()->SetTitle("Sts Correction Factor");
02783   hStsCorCalor->GetXaxis()->CenterTitle();
02784   hStsCorCalor->GetYaxis()->SetTitle("");
02785   hStsCorCalor->GetYaxis()->CenterTitle();
02786   hStsCorCalor->SetLineColor(1);
02787   //hStsCorCalor->SetBit(TH1::kCanRebin);
02788 
02789 
02790 
02791 
02792   TH1F* hGainCorSpect=new TH1F("hGainCorSpect","hGainCorSpect",500,0,5);
02793   hGainCorSpect->SetTitle("Gain Correction Factor");
02794   hGainCorSpect->GetXaxis()->SetTitle("Gain Correction Factor");
02795   hGainCorSpect->GetXaxis()->CenterTitle();
02796   hGainCorSpect->GetYaxis()->SetTitle("");
02797   hGainCorSpect->GetYaxis()->CenterTitle();
02798   hGainCorSpect->SetLineColor(2);
02799   //hGainCorSpect->SetBit(TH1::kCanRebin);
02800 
02801   TH1F* hAttenGreenCorSpect=new TH1F("hAttenGreenCorSpect","hAttenGreenCorSpect",
02802                                 500,0,5);
02803   hAttenGreenCorSpect->SetTitle("Green Fiber Correction Factor");
02804   hAttenGreenCorSpect->GetXaxis()->SetTitle("Green Fiber Correction Factor");
02805   hAttenGreenCorSpect->GetXaxis()->CenterTitle();
02806   hAttenGreenCorSpect->GetYaxis()->SetTitle("");
02807   hAttenGreenCorSpect->GetYaxis()->CenterTitle();
02808   hAttenGreenCorSpect->SetLineColor(3);
02809   //hAttenGreenCorSpect->SetBit(TH1::kCanRebin);
02810   
02811   TH1F* hAttenCorSpect=new TH1F("hAttenCorSpect","hAttenCorSpect",
02812                            500,0,5);
02813   hAttenCorSpect->SetTitle("Clear Fiber Correction Factor");
02814   hAttenCorSpect->GetXaxis()->SetTitle("Clear Fiber Correction Factor");
02815   hAttenCorSpect->GetXaxis()->CenterTitle();
02816   hAttenCorSpect->GetYaxis()->SetTitle("");
02817   hAttenCorSpect->GetYaxis()->CenterTitle();
02818   hAttenCorSpect->SetLineColor(4);
02819   //hAttenCorSpect->SetBit(TH1::kCanRebin);
02820   
02821   TH1F* hTotalCorSpect=new TH1F("hTotalCorSpect","hTotalCorSpect",
02822                            500,0,5);
02823   hTotalCorSpect->SetTitle("Total Correction Factor");
02824   hTotalCorSpect->GetXaxis()->SetTitle("Total Correction Factor");
02825   hTotalCorSpect->GetXaxis()->CenterTitle();
02826   hTotalCorSpect->GetYaxis()->SetTitle("");
02827   hTotalCorSpect->GetYaxis()->CenterTitle();
02828   hTotalCorSpect->SetLineColor(1);
02829   //hTotalCorSpect->SetBit(TH1::kCanRebin);
02830   
02831   TH1F* hStsCorSpect=new TH1F("hStsCorSpect","hStsCorSpect",
02832                            500,0,5);
02833   hStsCorSpect->SetTitle("Sts Correction Factor");
02834   hStsCorSpect->GetXaxis()->SetTitle("Sts Correction Factor");
02835   hStsCorSpect->GetXaxis()->CenterTitle();
02836   hStsCorSpect->GetYaxis()->SetTitle("");
02837   hStsCorSpect->GetYaxis()->CenterTitle();
02838   hStsCorSpect->SetLineColor(1);
02839   //hStsCorSpect->SetBit(TH1::kCanRebin);
02840   
02841 
02842 
02843   TProfile* pGainCorVsStrip=new TProfile
02844     ("pGainCorVsStrip","pGainCorVsStrip",50,0,100);
02845   pGainCorVsStrip->GetXaxis()->SetTitle("Strip");
02846   pGainCorVsStrip->GetXaxis()->CenterTitle();
02847   pGainCorVsStrip->GetYaxis()->SetTitle("Correction Factor");
02848   pGainCorVsStrip->GetYaxis()->CenterTitle();
02849   TProfile* pAttenCorVsStrip=new TProfile
02850     ("pAttenCorVsStrip","pAttenCorVsStrip",50,0,100);
02851   pAttenCorVsStrip->GetXaxis()->SetTitle("Strip");
02852   pAttenCorVsStrip->GetXaxis()->CenterTitle();
02853   pAttenCorVsStrip->GetYaxis()->SetTitle("Correction Factor");
02854   pAttenCorVsStrip->GetYaxis()->CenterTitle();
02855   TProfile* pAttenGreenCorVsStrip=new TProfile
02856     ("pAttenGreenCorVsStrip","pAttenGreenCorVsStrip",50,0,100);
02857   pAttenGreenCorVsStrip->GetXaxis()->SetTitle("Strip");
02858   pAttenGreenCorVsStrip->GetXaxis()->CenterTitle();
02859   pAttenGreenCorVsStrip->GetYaxis()->SetTitle("Correction Factor");
02860   pAttenGreenCorVsStrip->GetYaxis()->CenterTitle();
02861   TProfile* pTotalCorVsStrip=new TProfile
02862     ("pTotalCorVsStrip","pTotalCorVsStrip",50,0,100);
02863   pTotalCorVsStrip->GetXaxis()->SetTitle("Strip");
02864   pTotalCorVsStrip->GetXaxis()->CenterTitle();
02865   pTotalCorVsStrip->GetYaxis()->SetTitle("Correction Factor");
02866   pTotalCorVsStrip->GetYaxis()->CenterTitle();
02867   
02868 
02869   TProfile* pGainCorVsStripU=new TProfile
02870     ("pGainCorVsStripU","pGainCorVsStripU",50,0,100);
02871   pGainCorVsStripU->GetXaxis()->SetTitle("Strip");
02872   pGainCorVsStripU->GetXaxis()->CenterTitle();
02873   pGainCorVsStripU->GetYaxis()->SetTitle("Correction Factor");
02874   pGainCorVsStripU->GetYaxis()->CenterTitle();
02875   TProfile* pAttenCorVsStripU=new TProfile
02876     ("pAttenCorVsStripU","pAttenCorVsStripU",50,0,100);
02877   pAttenCorVsStripU->GetXaxis()->SetTitle("Strip");
02878   pAttenCorVsStripU->GetXaxis()->CenterTitle();
02879   pAttenCorVsStripU->GetYaxis()->SetTitle("Correction Factor");
02880   pAttenCorVsStripU->GetYaxis()->CenterTitle();
02881   TProfile* pAttenGreenCorVsStripU=new TProfile
02882     ("pAttenGreenCorVsStripU","pAttenGreenCorVsStripU",50,0,100);
02883   pAttenGreenCorVsStripU->GetXaxis()->SetTitle("Strip");
02884   pAttenGreenCorVsStripU->GetXaxis()->CenterTitle();
02885   pAttenGreenCorVsStripU->GetYaxis()->SetTitle("Correction Factor");
02886   pAttenGreenCorVsStripU->GetYaxis()->CenterTitle();
02887   TProfile* pTotalCorVsStripU=new TProfile
02888     ("pTotalCorVsStripU","pTotalCorVsStripU",50,0,100);
02889   pTotalCorVsStripU->GetXaxis()->SetTitle("Strip");
02890   pTotalCorVsStripU->GetXaxis()->CenterTitle();
02891   pTotalCorVsStripU->GetYaxis()->SetTitle("Correction Factor");
02892   pTotalCorVsStripU->GetYaxis()->CenterTitle();
02893 
02894   TProfile* pGainCorVsStripV=new TProfile
02895     ("pGainCorVsStripV","pGainCorVsStripV",50,0,100);
02896   pGainCorVsStripV->GetXaxis()->SetTitle("Strip");
02897   pGainCorVsStripV->GetXaxis()->CenterTitle();
02898   pGainCorVsStripV->GetYaxis()->SetTitle("Correction Factor");
02899   pGainCorVsStripV->GetYaxis()->CenterTitle();
02900   TProfile* pAttenCorVsStripV=new TProfile
02901     ("pAttenCorVsStripV","pAttenCorVsStripV",50,0,100);
02902   pAttenCorVsStripV->GetXaxis()->SetTitle("Strip");
02903   pAttenCorVsStripV->GetXaxis()->CenterTitle();
02904   pAttenCorVsStripV->GetYaxis()->SetTitle("Correction Factor");
02905   pAttenCorVsStripV->GetYaxis()->CenterTitle();
02906   TProfile* pAttenGreenCorVsStripV=new TProfile
02907     ("pAttenGreenCorVsStripV","pAttenGreenCorVsStripV",50,0,100);
02908   pAttenGreenCorVsStripV->GetXaxis()->SetTitle("Strip");
02909   pAttenGreenCorVsStripV->GetXaxis()->CenterTitle();
02910   pAttenGreenCorVsStripV->GetYaxis()->SetTitle("Correction Factor");
02911   pAttenGreenCorVsStripV->GetYaxis()->CenterTitle();
02912   TProfile* pTotalCorVsStripV=new TProfile
02913     ("pTotalCorVsStripV","pTotalCorVsStripV",50,0,100);
02914   pTotalCorVsStripV->GetXaxis()->SetTitle("Strip");
02915   pTotalCorVsStripV->GetXaxis()->CenterTitle();
02916   pTotalCorVsStripV->GetYaxis()->SetTitle("Correction Factor");
02917   pTotalCorVsStripV->GetYaxis()->CenterTitle();
02918 
02919 
02920 
02921   TProfile* pCfVsTU1=new TProfile("pCfVsTU1","pCfVsTU1",300,-5,5);
02922   TProfile* pCfVsTU2=new TProfile("pCfVsTU2","pCfVsTU2",300,-5,5);
02923   TProfile* pCfVsTV1=new TProfile("pCfVsTV1","pCfVsTV1",300,-5,5);
02924   TProfile* pCfVsTV2=new TProfile("pCfVsTV2","pCfVsTV2",300,-5,5);
02925   
02926   TProfile* pPtVsTU1=new TProfile("pPtVsTU1","pPtVsTU1",300,-5,5);
02927   TProfile* pPtVsTU2=new TProfile("pPtVsTU2","pPtVsTU2",300,-5,5);
02928   TProfile* pPtVsTV1=new TProfile("pPtVsTV1","pPtVsTV1",300,-5,5);
02929   TProfile* pPtVsTV2=new TProfile("pPtVsTV2","pPtVsTV2",300,-5,5);
02930  
02931   TProfile* pHlVsTU1=new TProfile("pHlVsTU1","pHlVsTU1",300,-5,5);
02932   TProfile* pHlVsTU2=new TProfile("pHlVsTU2","pHlVsTU2",300,-5,5);
02933   TProfile* pHlVsTV1=new TProfile("pHlVsTV1","pHlVsTV1",300,-5,5);
02934   TProfile* pHlVsTV2=new TProfile("pHlVsTV2","pHlVsTV2",300,-5,5);
02935 
02936   TGraph* gCfVsTAll=new TGraph(2);
02937   gCfVsTAll->SetMarkerColor(0);
02938   TGraph* gCfVsTUF=new TGraph(2);
02939   gCfVsTUF->SetMarkerStyle(8);
02940   TGraph* gCfVsTUP=new TGraph(2);
02941   gCfVsTUP->SetMarkerStyle(8);
02942   TGraph* gCfVsTVF=new TGraph(2);
02943   gCfVsTVF->SetMarkerStyle(8);
02944   TGraph* gCfVsTVP=new TGraph(2);
02945   gCfVsTVP->SetMarkerStyle(8);
02946 
02947   TGraph* gPtVsTAll=new TGraph(2);
02948   gPtVsTAll->SetMarkerColor(0);
02949   TGraph* gPtVsTUF=new TGraph(2);
02950   gPtVsTUF->SetMarkerStyle(8);
02951   TGraph* gPtVsTUP=new TGraph(2);
02952   gPtVsTUP->SetMarkerStyle(8);
02953   TGraph* gPtVsTVF=new TGraph(2);
02954   gPtVsTVF->SetMarkerStyle(8);
02955   TGraph* gPtVsTVP=new TGraph(2);
02956   gPtVsTVP->SetMarkerStyle(8);
02957   
02958   TGraph* gHlVsTAll=new TGraph(2);
02959   gHlVsTAll->SetMarkerColor(0);
02960   TGraph* gHlVsTUF=new TGraph(2);
02961   gHlVsTUF->SetMarkerStyle(8);
02962   TGraph* gHlVsTUP=new TGraph(2);
02963   gHlVsTUP->SetMarkerStyle(8);
02964   TGraph* gHlVsTVF=new TGraph(2);
02965   gHlVsTVF->SetMarkerStyle(8);
02966   TGraph* gHlVsTVP=new TGraph(2);
02967   gHlVsTVP->SetMarkerStyle(8);
02968 
02969   TGraph* gCentreAll=new TGraph(2);
02970   gCentreAll->SetMarkerColor(0);
02971   gCentreAll->SetPoint(0,-1.35,-2.0);
02972   gCentreAll->SetPoint(1,2.52,2.0);
02973   //pAdcYvsXU->GetXaxis()->SetRangeUser(-1.75,2.92);
02974   //pAdcYvsXU->GetYaxis()->SetRangeUser(-2.33,2.33);
02975   TGraph* gCentreUF=new TGraph(2);
02976   gCentreUF->SetMarkerStyle(8);
02977   TGraph* gCentreUP=new TGraph(2);
02978   gCentreUP->SetMarkerStyle(8);
02979   TGraph* gCentreVF=new TGraph(2);
02980   gCentreVF->SetMarkerStyle(8);
02981   TGraph* gCentreVP=new TGraph(2);
02982   gCentreVP->SetMarkerStyle(8);
02983   
02984   //Int_t plane=250;//even=U-view=2 in SM1 (even=V-view=3 in SM2)
02985 
02986   //variables to store averages  
02987   Float_t avAttenCalorStored=0.794919;
02988   Float_t avAttenGreenCalorStored=0.419917;
02989   Float_t avGainCalorStored=105.485;//VldTimeStamp(2005,11,14,0,0,1);
02990 
02991   //Float_t avAttenCalorPIStored=0.799463;
02992   //Float_t avAttenGreenCalorPIStored=0.433252;
02993   //Float_t avGainCalorPIStored=105.574;//VldTimeStamp(2005,11,14,0,0,1);
02994 
02995   Float_t avStsCorrectionCalor=0;
02996   Float_t avStsCorrectionCalcCalor=0;
02997   Float_t avAttenCalor=0;
02998   Float_t avAttenGreenCalor=0;
02999   Float_t avGainCalor=0;
03000   Int_t avCalorCounter=0;
03001 
03002   Float_t avStsCorrectionCalorPI=0;
03003   Float_t avStsCorrectionCalcCalorPI=0;
03004   Float_t avAttenCalorPI=0;
03005   Float_t avAttenGreenCalorPI=0;
03006   Float_t avGainCalorPI=0;
03007   Int_t avCalorPICounter=0;
03008 
03009   //Float_t avAttenSpectStored=0.740317;
03010   //Float_t avAttenGreenSpectStored=0.384357;
03011   //Float_t avGainSpectStored=103.231;//VldTimeStamp(2005,11,14,0,0,1);
03012 
03013   Float_t avStsCorrection=0;
03014   Float_t avStsCorrectionCalc=0;
03015   Float_t avAtten=0;
03016   Float_t avAttenGreen=0;
03017   Float_t avGain=0;
03018   Int_t avCounter=0;
03019 
03020   //get the UGH
03021   UgliGeomHandle ugh(*vc);
03022 
03023   if (dt==Detector::kFar){
03024     for (Int_t p=250;p<280;p++){
03025       PlexPlaneId ppid(dt,p);
03026       UgliScintPlnHandle usph=ugh.GetScintPlnHandle(ppid);
03027     
03028       for (Int_t i=0;i<192;i++){
03029         Int_t strip=i;
03030         PlexStripEndId seid(dt,p,strip,StripEnd::kWhole);
03031         UgliStripHandle ush=ugh.GetStripHandle(seid);
03032       
03033         Float_t clearFiber1=ush.ClearFiber(StripEnd::kEast);
03034         Float_t clearFiber2=ush.ClearFiber(StripEnd::kWest);
03035         Float_t pigtail1=ush.WlsPigtail(StripEnd::kEast);
03036         Float_t pigtail2=ush.WlsPigtail(StripEnd::kWest);
03037         Float_t tpos=ush.GetTPos();
03038         Float_t halfLength1=ush.GetHalfLength();
03039         Float_t halfLength2=ush.GetHalfLength();
03040  
03041 
03042         if (usph.GetPlaneView()==PlaneView::kU){
03043           cout<<"U-View: Strip="<<strip<<", tpos="<<tpos
03044               <<", clearF1="<<clearFiber1
03045               <<", clearF2="<<clearFiber2
03046               <<", halfL1="<<halfLength1
03047               <<", halfL2="<<halfLength2
03048               <<endl;
03049           pCfVsTU1->Fill(tpos,clearFiber1);
03050           pCfVsTU2->Fill(tpos,clearFiber2);
03051           pCfVsTU1->Fill(tpos,clearFiber1*1.0001);
03052           pCfVsTU2->Fill(tpos,clearFiber2*1.0001);
03053           pPtVsTU1->Fill(tpos,pigtail1);
03054           pPtVsTU2->Fill(tpos,pigtail2);
03055           pPtVsTU1->Fill(tpos,pigtail1*1.0001);
03056           pPtVsTU2->Fill(tpos,pigtail2*1.0001);
03057 
03058           pHlVsTU1->Fill(tpos,halfLength1);
03059           pHlVsTU2->Fill(tpos,halfLength2);
03060           pHlVsTU1->Fill(tpos,halfLength1*1.0001);
03061           pHlVsTU2->Fill(tpos,halfLength2*1.0001);
03062         }
03063         else if (usph.GetPlaneView()==PlaneView::kV){
03064           cout<<"V-View: Strip="<<strip<<", tpos="<<tpos
03065               <<", clearF1="<<clearFiber1
03066               <<", clearF2="<<clearFiber2
03067               <<", halfL1="<<halfLength1
03068               <<", halfL2="<<halfLength2
03069               <<endl;
03070             pCfVsTV1->Fill(tpos,clearFiber1);
03071           pCfVsTV2->Fill(tpos,clearFiber2);
03072           pCfVsTV1->Fill(tpos,clearFiber1*1.0001);
03073           pCfVsTV2->Fill(tpos,clearFiber2*1.0001);
03074           pPtVsTV1->Fill(tpos,pigtail1);
03075           pPtVsTV2->Fill(tpos,pigtail2);
03076           pPtVsTV1->Fill(tpos,pigtail1*1.0001);
03077           pPtVsTV2->Fill(tpos,pigtail2*1.0001);
03078 
03079           pHlVsTV1->Fill(tpos,halfLength1);
03080           pHlVsTV2->Fill(tpos,halfLength2);
03081           pHlVsTV1->Fill(tpos,halfLength1*1.0001);
03082           pHlVsTV2->Fill(tpos,halfLength2*1.0001);
03083         }
03084         else cout<<"ahhhh"<<endl;
03085       }
03086     }
03087   }
03088   else if (dt==Detector::kNear){
03089 
03090     cout<<endl<<endl<<"Doing calorimeter"<<endl;
03091     for (Int_t p=1;p<=120;p++){
03092       PlexPlaneId ppid(dt,p);
03093       UgliScintPlnHandle usph=ugh.GetScintPlnHandle(ppid);
03094     
03095       for (Int_t i=0;i<96;i++){//0-95
03096 
03097         //planes are 0-63 or 4-67
03098         //odd planes = U-view (1,3,5)
03099         if (i>63 && (p-1)%5!=0 && p%2!=0) continue;
03100         //even planes = V-view (2,4,6)
03101         if ((i<4 || i>67) && (p-1)%5!=0 && p%2==0) continue;
03102 
03103         MAXMSG("MeuPlots",Msg::kInfo,2000)
03104           <<"pl="<<p<<", st="<<i<<endl;
03105         
03106         //strips TPos:
03107         //plane 6 goes -2.64 -> 1.32 m
03108         //plane 11 goes -1.32 -> 2.64 m
03109         
03110         //plane 4,8,10 goes -2.40 -> 0.24 m (V-view)
03111         //plane 5,7,9 goes -0.24 -> 2.40 m (U-view)
03112         
03113         //2.64 - 2.40 = 24 cm = 5.85 strips
03114         //the FI planes "stick out" by ~6 strips
03115         
03116         //Tobi's code snippet:
03117         // in the near detector, a further check is needed:
03118         // partial U planes have strips 0-63
03119         // partial V planes have strips 4-67
03120         //if (det==Detector::kNear) {
03121         //  if (((pl-1)%5) && (pl%2)    && st>63) continue;
03122         //  if (((pl-1)%5) && (pl%2)==0 && st<4 ) continue;
03123         //}
03124         Int_t strip=i;
03125         PlexStripEndId seid(dt,p,strip,StripEnd::kWhole);
03126         UgliStripHandle ush=ugh.GetStripHandle(seid);
03127       
03128         Float_t clearFiber1=0;
03129         Float_t clearFiber2=ush.ClearFiber(StripEnd::kWest);
03130         Float_t pigtail1=0;
03131         Float_t pigtail2=ush.WlsPigtail(StripEnd::kWest);
03132         Float_t tpos=ush.GetTPos();
03133         Float_t halfLength1=0;
03134         Float_t halfLength2=ush.GetHalfLength();
03135 //virtual TVector3      GlobalPos (const Float_t alongLength, const Bool_t onWLS=kFALSE) const
03136         TVector3 centre=ush.GlobalPos(0);
03137         Float_t x=centre.X();
03138         Float_t y=centre.Y();
03139         
03140         static Int_t iAll=2;//already done 2 points
03141         gCfVsTAll->SetPoint(iAll,tpos,clearFiber2);
03142         gPtVsTAll->SetPoint(iAll,tpos,pigtail2);
03143         gHlVsTAll->SetPoint(iAll,tpos,halfLength2);
03144         gCentreAll->SetPoint(iAll,x,y);
03145         iAll++;
03146   
03147 
03148         Float_t greenFiber=halfLength2+pigtail2;
03149         Float_t attenGreen=0.5*TMath::Exp(-greenFiber/1)+
03150           0.5*TMath::Exp(-greenFiber/6);
03151 
03152         //calc gain and atten
03153         PlexStripEndId seid2(dt,p,i,StripEnd::kWest);
03154         Float_t pe=cal.GetPhotoElectrons(100,seid2);
03155         Float_t sts=cal.GetStripToStripCorrected(1,seid2);
03156         Float_t gain=100/pe;
03157         Float_t atten=TMath::Exp(-clearFiber2/12);
03158         
03159         //Float_t gainResp=gain/avGainCalorStored;
03160         //Float_t attenResp=atten/avAttenCalorStored;
03161         //Float_t attenGreenResp=attenGreen/avAttenGreenCalorStored;
03162 
03163         Float_t gainResp=gain/avGainCalorStored;
03164         Float_t attenResp=atten/avAttenCalorStored;
03165         Float_t attenGreenResp=attenGreen/avAttenGreenCalorStored;
03166 
03167         Float_t gainCor=1./gainResp;
03168         Float_t attenCor=1./attenResp;
03169         Float_t attenGreenCor=1./attenGreenResp;
03170 
03171         Float_t response=1*gainResp*attenResp*attenGreenResp;
03172         Float_t stsCalc=1./response;
03173         
03174         
03175         //fill histos
03176         hGainCorCalor->Fill(gainCor);
03177         hAttenCorCalor->Fill(attenCor);
03178         hAttenGreenCorCalor->Fill(attenGreenCor);
03179         hTotalCorCalor->Fill(stsCalc);
03180         hStsCorCalor->Fill(sts);
03181 
03182         //sum up for average
03183         avAttenCalor+=atten;
03184         avAttenGreenCalor+=attenGreen;
03185         avGainCalor+=gain;
03186         avStsCorrectionCalor+=sts;
03187         avStsCorrectionCalcCalor+=stsCalc;
03188         avCalorCounter++;
03189 
03190         if ((p-1)%5!=0) {//if there is a remainder it's partial
03191           MAXMSG("MeuPlots",Msg::kInfo,2000)
03192             <<"PARTIAL: pl,st="<<p<<","<<i<<endl;
03193           avAttenCalorPI+=atten;
03194           avAttenGreenCalorPI+=attenGreen;
03195           avGainCalorPI+=gain;
03196           avStsCorrectionCalorPI+=sts;
03197           avStsCorrectionCalcCalorPI+=stsCalc;
03198           avCalorPICounter++;
03199         }
03200 
03201 
03202         if (usph.GetPlaneView()==PlaneView::kU){
03203 
03204           static Int_t iUF=0;
03205           static Int_t iUP=0;
03206           if ((p-1)%5==0) {
03207             gCfVsTUF->SetPoint(iUF,tpos,clearFiber2);
03208             gPtVsTUF->SetPoint(iUF,tpos,pigtail2);
03209             gHlVsTUF->SetPoint(iUF,tpos,halfLength2);
03210             gCentreUF->SetPoint(iUF,x,y);
03211             iUF++;
03212           }
03213           else {
03214             gCfVsTUP->SetPoint(iUP,tpos,clearFiber2);
03215             gPtVsTUP->SetPoint(iUP,tpos,pigtail2);
03216             gHlVsTUP->SetPoint(iUP,tpos,halfLength2);
03217             gCentreUP->SetPoint(iUP,x,y);
03218             iUP++;
03219           }
03220           
03221           cout<<"U-View: Strip="<<strip<<", tpos="<<tpos
03222               <<", clearF1="<<clearFiber1
03223               <<", clearF2="<<clearFiber2
03224               <<", halfL1="<<halfLength1
03225               <<", halfL2="<<halfLength2
03226               <<endl;
03227           pCfVsTU1->Fill(tpos,clearFiber1);
03228           pCfVsTU2->Fill(tpos,clearFiber2);
03229           pCfVsTU1->Fill(tpos,clearFiber1*1.0001);
03230           pCfVsTU2->Fill(tpos,clearFiber2*1.0001);
03231           pPtVsTU1->Fill(tpos,pigtail1);
03232           pPtVsTU2->Fill(tpos,pigtail2);
03233           pPtVsTU1->Fill(tpos,pigtail1*1.0001);
03234           pPtVsTU2->Fill(tpos,pigtail2*1.0001);
03235 
03236           pHlVsTU1->Fill(tpos,halfLength1);
03237           pHlVsTU2->Fill(tpos,halfLength2);
03238           pHlVsTU1->Fill(tpos,halfLength1*1.0001);
03239           pHlVsTU2->Fill(tpos,halfLength2*1.0001);
03240         }
03241         else if (usph.GetPlaneView()==PlaneView::kV){
03242           
03243           static Int_t iVF=0;
03244           static Int_t iVP=0;
03245           if ((p-1)%5==0) {
03246             gCfVsTVF->SetPoint(iVF,tpos,clearFiber2);
03247             gPtVsTVF->SetPoint(iVF,tpos,pigtail2);
03248             gHlVsTVF->SetPoint(iVF,tpos,halfLength2);
03249             gCentreVF->SetPoint(iVF,x,y);
03250             iVF++;
03251           }
03252           else {
03253             gCfVsTVP->SetPoint(iVP,tpos,clearFiber2);
03254             gPtVsTVP->SetPoint(iVP,tpos,pigtail2);
03255             gHlVsTVP->SetPoint(iVP,tpos,halfLength2);
03256             gCentreVP->SetPoint(iVP,x,y);
03257             iVP++;
03258           }
03259                
03260           cout<<"V-View: Strip="<<strip<<", tpos="<<tpos
03261               <<", clearF1="<<clearFiber1
03262               <<", clearF2="<<clearFiber2
03263               <<", halfL1="<<halfLength1
03264               <<", halfL2="<<halfLength2
03265               <<endl;
03266           pCfVsTV1->Fill(tpos,clearFiber1);
03267           pCfVsTV2->Fill(tpos,clearFiber2);
03268           pCfVsTV1->Fill(tpos,clearFiber1*1.0001);
03269           pCfVsTV2->Fill(tpos,clearFiber2*1.0001);
03270           pPtVsTV1->Fill(tpos,pigtail1);
03271           pPtVsTV2->Fill(tpos,pigtail2);
03272           pPtVsTV1->Fill(tpos,pigtail1*1.0001);
03273           pPtVsTV2->Fill(tpos,pigtail2*1.0001);
03274 
03275           pHlVsTV1->Fill(tpos,halfLength1);
03276           pHlVsTV2->Fill(tpos,halfLength2);
03277           pHlVsTV1->Fill(tpos,halfLength1*1.0001);
03278           pHlVsTV2->Fill(tpos,halfLength2*1.0001);
03279         }
03280         else cout<<"ahhhh"<<endl;
03281       }
03282     }
03283 
03286     cout<<endl<<endl<<"Doing spectrometer"<<endl;
03287     for (Int_t p=121;p<=281;p++){
03288       PlexPlaneId ppid(dt,p);
03289       UgliScintPlnHandle usph=ugh.GetScintPlnHandle(ppid);
03290     
03291       for (Int_t i=0;i<96;i++){//0-95
03292         
03293         //skip the non-scintillator planes
03294         if ((p-1)%5!=0) continue;
03295        
03296 
03297         MAXMSG("MeuPlots",Msg::kInfo,20)
03298           <<"pl="<<p<<", st="<<i<<endl;
03299         
03300         Int_t strip=i;
03301         PlexStripEndId seid(dt,p,strip,StripEnd::kWhole);
03302         UgliStripHandle ush=ugh.GetStripHandle(seid);
03303       
03304         //Float_t clearFiber1=0;
03305         Float_t clearFiber2=ush.ClearFiber(StripEnd::kWest);
03306         //Float_t pigtail1=0;
03307         Float_t pigtail2=ush.WlsPigtail(StripEnd::kWest);
03308         //Float_t tpos=ush.GetTPos();
03309         //Float_t halfLength1=0;
03310         Float_t halfLength2=ush.GetHalfLength();
03311 //virtual TVector3 GlobalPos(const Float_t alongLength, const Bool_t onWLS=kFALSE) const
03312         TVector3 centre=ush.GlobalPos(0);
03313         //Float_t x=centre.X();
03314         //Float_t y=centre.Y();
03315         
03316         Float_t greenFiber=halfLength2+pigtail2;
03317         Float_t attenGreen=0.5*TMath::Exp(-greenFiber/1)+
03318           0.5*TMath::Exp(-greenFiber/6);
03319 
03320         //calc gain and atten
03321         PlexStripEndId seid2(dt,p,i,StripEnd::kWest);
03322         Float_t pe=cal.GetPhotoElectrons(100,seid2);
03323         Float_t sts=cal.GetStripToStripCorrected(1,seid2);
03324         Float_t gain=100/pe;
03325         Float_t atten=TMath::Exp(-clearFiber2/12);
03326         
03327         //Float_t gainResp=gain/avGainSpectStored;
03328         //Float_t attenResp=atten/avAttenSpectStored;
03329         //Float_t attenGreenResp=attenGreen/avAttenGreenSpectStored;
03330 
03331         Float_t gainResp=gain/avGainCalorStored;
03332         Float_t attenResp=atten/avAttenCalorStored;
03333         Float_t attenGreenResp=attenGreen/avAttenGreenCalorStored;
03334         
03335         Float_t gainCor=1./gainResp;
03336         Float_t attenCor=1./attenResp;
03337         Float_t attenGreenCor=1./attenGreenResp;
03338 
03339         Float_t response=1*gainResp*attenResp*attenGreenResp;
03340         Float_t stsCalc=1./response;
03341         
03342         //fill histos
03343         hGainCorSpect->Fill(gainCor);
03344         hAttenCorSpect->Fill(attenCor);
03345         hAttenGreenCorSpect->Fill(attenGreenCor);
03346         hTotalCorSpect->Fill(stsCalc);
03347         hStsCorSpect->Fill(sts);
03348 
03349         pGainCorVsStrip->Fill(strip,gainCor);
03350         pAttenCorVsStrip->Fill(strip,attenCor);
03351         pAttenGreenCorVsStrip->Fill(strip,attenGreenCor);
03352         pTotalCorVsStrip->Fill(strip,stsCalc);
03353 
03354         //sum up for average
03355         avAtten+=atten;
03356         avAttenGreen+=attenGreen;
03357         avGain+=gain;
03358         avStsCorrection+=sts;
03359         avStsCorrectionCalc+=stsCalc;
03360         avCounter++;
03361 
03362         if (p>250) {
03363         MAXMSG("MeuPlots",Msg::kInfo,2000)
03364           <<"pl,st="<<p<<","<<i
03365           <<", cFib="<<clearFiber2
03366           <<", att="<<atten
03367           <<", attG="<<attenGreen
03368           <<", gn="<<gain
03369           <<", sts="<<sts
03370           <<", stsMe="<<stsCalc
03371           <<endl;
03372 
03373         MAXMSG("MeuPlots",Msg::kInfo,2000)
03374           <<"      gnCor="<<gainCor
03375           <<", attCor="<<attenCor
03376           <<", attGCor="<<attenGreenCor
03377           <<", total="<<stsCalc
03378           <<endl;
03379         }
03380   
03381         if (usph.GetPlaneView()==PlaneView::kU){
03382           pGainCorVsStripU->Fill(strip,gainCor);
03383           pAttenCorVsStripU->Fill(strip,attenCor);
03384           pAttenGreenCorVsStripU->Fill(strip,attenGreenCor);
03385           pTotalCorVsStripU->Fill(strip,stsCalc);
03386         }
03387         else if (usph.GetPlaneView()==PlaneView::kV){
03388           pGainCorVsStripV->Fill(strip,gainCor);
03389           pAttenCorVsStripV->Fill(strip,attenCor);
03390           pAttenGreenCorVsStripV->Fill(strip,attenGreenCor);
03391           pTotalCorVsStripV->Fill(strip,stsCalc);
03392         }
03393         else cout<<"ahhhh"<<endl;
03394       }
03395     }
03396   }
03397   else cout<<"No det"<<endl;
03398 
03399   //calc average
03400   avAttenCalor/=avCalorCounter;
03401   avAttenGreenCalor/=avCalorCounter;
03402   avGainCalor/=avCalorCounter;
03403   avStsCorrectionCalor/=avCalorCounter;
03404   avStsCorrectionCalcCalor/=avCalorCounter;
03405 
03406   avAttenCalorPI/=avCalorPICounter;
03407   avAttenGreenCalorPI/=avCalorPICounter;
03408   avGainCalorPI/=avCalorPICounter;
03409   avStsCorrectionCalorPI/=avCalorPICounter;
03410   avStsCorrectionCalcCalorPI/=avCalorPICounter;
03411 
03412 
03413   avAtten/=avCounter;
03414   avAttenGreen/=avCounter;
03415   avGain/=avCounter;
03416   avStsCorrection/=avCounter;
03417   avStsCorrectionCalc/=avCounter;
03418 
03419 
03420   Double_t quantile=0.5;//quantile to compute
03421 
03422   Double_t medianAttenGreenCorCalor=-1;
03423   hAttenGreenCorCalor->GetQuantiles(1,&medianAttenGreenCorCalor,&quantile);
03424   Double_t meanAttenGreenCorCalor=hAttenGreenCorCalor->GetMean();
03425 
03426   Double_t medianAttenCorCalor=-1;
03427   hAttenCorCalor->GetQuantiles(1,&medianAttenCorCalor,&quantile);
03428   Double_t meanAttenCorCalor=hAttenCorCalor->GetMean();
03429 
03430   Double_t medianGainCorCalor=-1;
03431   hGainCorCalor->GetQuantiles(1,&medianGainCorCalor,&quantile);
03432   Double_t meanGainCorCalor=hGainCorCalor->GetMean();
03433 
03434   Double_t medianTotalCorCalor=-1;
03435   hTotalCorCalor->GetQuantiles(1,&medianTotalCorCalor,&quantile);
03436   Double_t meanTotalCorCalor=hTotalCorCalor->GetMean();
03437 
03438   Double_t medianStsCorCalor=-1;
03439   hStsCorCalor->GetQuantiles(1,&medianStsCorCalor,&quantile);
03440   Double_t meanStsCorCalor=hStsCorCalor->GetMean();
03441 
03442 
03443 
03444 
03445   Double_t medianAttenGreenCorSpect=-1;
03446   hAttenGreenCorSpect->GetQuantiles(1,&medianAttenGreenCorSpect,&quantile);
03447   Double_t meanAttenGreenCorSpect=hAttenGreenCorSpect->GetMean();
03448 
03449   Double_t medianAttenCorSpect=-1;
03450   hAttenCorSpect->GetQuantiles(1,&medianAttenCorSpect,&quantile);
03451   Double_t meanAttenCorSpect=hAttenCorSpect->GetMean();
03452 
03453   Double_t medianGainCorSpect=-1;
03454   hGainCorSpect->GetQuantiles(1,&medianGainCorSpect,&quantile);
03455   Double_t meanGainCorSpect=hGainCorSpect->GetMean();
03456 
03457   Double_t medianTotalCorSpect=-1;
03458   hTotalCorSpect->GetQuantiles(1,&medianTotalCorSpect,&quantile);
03459   Double_t meanTotalCorSpect=hTotalCorSpect->GetMean();
03460 
03461   Double_t medianStsCorSpect=-1;
03462   hStsCorSpect->GetQuantiles(1,&medianStsCorSpect,&quantile);
03463   Double_t meanStsCorSpect=hStsCorSpect->GetMean();
03464 
03465 
03466   cout<<endl<<"Calorimeter:"<<endl;
03467   cout<<"N="<<avCalorCounter<<endl;
03468   cout<<"Average attenuation (clear)="<<avAttenCalor<<endl;
03469   cout<<"Average attenuation (green)="<<avAttenGreenCalor<<endl;
03470   cout<<"Average gain               ="<<avGainCalor<<endl;
03471   cout<<"Average sts correction     ="<<avStsCorrectionCalor<<endl;
03472   cout<<"Average sts correction calc="<<avStsCorrectionCalcCalor<<endl;
03473 
03474   cout<<endl<<"Calorimeter (PARTIAL PLANES ONLY):"<<endl;
03475   cout<<"N="<<avCalorPICounter<<endl;
03476   cout<<"Average attenuation (clear)="<<avAttenCalorPI<<endl;
03477   cout<<"Average attenuation (green)="<<avAttenGreenCalorPI<<endl;
03478   cout<<"Average gain               ="<<avGainCalorPI<<endl;
03479   cout<<"Average sts correction     ="<<avStsCorrectionCalorPI<<endl;
03480   cout<<"Average sts correction calc="<<avStsCorrectionCalcCalorPI<<endl;
03481 
03482   cout<<endl<<"Spectrometer:"<<endl;
03483   cout<<"N="<<avCounter<<endl;
03484   cout<<"Average attenuation (clear)="<<avAtten<<endl;
03485   cout<<"Average attenuation (green)="<<avAttenGreen<<endl;
03486   cout<<"Average gain               ="<<avGain<<endl;
03487   cout<<"Average sts correction     ="<<avStsCorrection<<endl;
03488   cout<<"Average sts correction calc="<<avStsCorrectionCalc<<endl;
03489   
03490   Float_t attenDiff=(avAttenCalor-avAtten)/avAttenCalor;
03491   Float_t attenGreenDiff=(avAttenGreenCalor-avAttenGreen)/
03492     avAttenGreenCalor;
03493   Float_t gainDiff=(avGainCalor-avGain)/avGainCalor;
03494   
03495   Float_t totalDiff=attenDiff+attenGreenDiff+gainDiff;
03496   
03497 
03498   Float_t attenCalorPIDiff=(avAttenCalorPI-avAtten)/avAttenCalorPI;
03499   Float_t attenGreenCalorPIDiff=(avAttenGreenCalorPI-avAttenGreen)/
03500     avAttenGreenCalorPI;
03501   Float_t gainCalorPIDiff=(avGainCalorPI-avGain)/avGainCalorPI;
03502   
03503   Float_t totalCalorPIDiff=attenCalorPIDiff+attenGreenCalorPIDiff+
03504     gainCalorPIDiff;
03505   
03506 
03507 
03508   cout<<endl<<"Spectrometer difference wrt calorimeter:"<<endl;
03509   cout<<"Attenuation (clear)="<<attenDiff<<endl
03510       <<"Attenuation (green)="<<attenGreenDiff<<endl
03511       <<"Gain               ="<<gainDiff<<endl
03512       <<"Total              ="<<totalDiff<<endl;
03513   cout<<endl;
03514 
03515   cout<<endl<<"Spectrometer difference wrt PARTIAL PLANES in calorimeter:"<<endl;
03516   cout<<"Attenuation (clear)="<<attenCalorPIDiff<<endl
03517       <<"Attenuation (green)="<<attenGreenCalorPIDiff<<endl
03518       <<"Gain               ="<<gainCalorPIDiff<<endl
03519       <<"Total              ="<<totalCalorPIDiff<<endl;
03520   cout<<endl;
03521 
03522 
03523   cout<<endl<<endl;
03524   cout<<"Calorimeter average correction factors from histos:"<<endl;
03525   cout<<"Attenuation (clear) median="<<medianAttenCorCalor
03526       <<", mean="<<meanAttenCorCalor
03527       <<endl;
03528   cout<<"Attenuation (green) median="<<medianAttenGreenCorCalor
03529       <<", mean="<<meanAttenGreenCorCalor
03530       <<endl;
03531   cout<<"Gain                median="<<medianGainCorCalor
03532       <<", mean="<<meanGainCorCalor
03533       <<endl;
03534   cout<<"Total               median="<<medianTotalCorCalor
03535       <<", mean="<<meanTotalCorCalor
03536       <<endl;
03537   cout<<"Sts               median="<<medianStsCorCalor
03538       <<", mean="<<meanStsCorCalor
03539       <<endl;
03540   
03541   
03542   cout<<endl<<endl;
03543   cout<<"Spectrometer average correction factors from histos:"<<endl;
03544   cout<<"Attenuation (clear) median="<<medianAttenCorSpect
03545       <<", mean="<<meanAttenCorSpect
03546       <<endl;
03547   cout<<"Attenuation (green) median="<<medianAttenGreenCorSpect
03548       <<", mean="<<meanAttenGreenCorSpect
03549       <<endl;
03550   cout<<"Gain                median="<<medianGainCorSpect
03551       <<", mean="<<meanGainCorSpect
03552       <<endl;
03553   cout<<"Total               median="<<medianTotalCorSpect
03554       <<", mean="<<meanTotalCorSpect
03555       <<endl;
03556   cout<<"Sts               median="<<medianStsCorSpect
03557       <<", mean="<<meanStsCorSpect
03558       <<endl;
03559 
03560 
03561   //gStyle->SetOptStat(0);
03562   gStyle->SetOptFit(0);
03563   gStyle->SetPalette(1);
03564   gStyle->SetTitleFontSize(0.06);
03565   gStyle->SetTitleFillColor(0);
03566   gStyle->SetTitleBorderSize(0);
03567   gStyle->SetFrameBorderMode(0);
03568   gStyle->SetTitleW(0.99);
03569 
03570   
03571   TCanvas* cCorrectionFactorsCalor=new TCanvas
03572     ("cCorrectionFactorsCalor","cCorrectionFactorsCalor",
03573      //0,0,750,650);
03574      0,0,1100,1000);
03575   cCorrectionFactorsCalor->SetFillColor(0);
03576   cCorrectionFactorsCalor->Divide(1,2);
03577   cCorrectionFactorsCalor->cd(1);
03578   hAttenGreenCorCalor->Draw();
03579   hAttenGreenCorCalor->SetTitle("Correction Factors");
03580   hAttenGreenCorCalor->GetXaxis()->SetTitle("Correction Factor");
03581   hAttenGreenCorCalor->GetXaxis()->SetRangeUser(0.2,2.5);
03582   hTotalCorCalor->Draw("SAMES");
03583   hGainCorCalor->Draw("SAMES");
03584   hAttenCorCalor->Draw("SAMES");
03585   cCorrectionFactorsCalor->cd(2);
03586   TH1F* hCalor=static_cast<TH1F*>(hTotalCorCalor->Clone());
03587   hCalor->Draw();
03588   hCalor->Rebin(4);
03589   hCalor->GetXaxis()->SetRangeUser(0.2,2.5);
03590   hCalor->SetLineStyle(1);
03591   hCalor->SetLineColor(2);
03592   hCalor->SetLineWidth(3);
03593   hStsCorCalor->Draw("SAMES");
03594   hStsCorCalor->GetXaxis()->SetRangeUser(0.2,2.5);
03595   hStsCorCalor->Rebin(4);
03596   hStsCorCalor->SetLineStyle(5);
03597   hStsCorCalor->SetLineWidth(3);
03598 
03599 
03600 
03601 
03602   TCanvas* cCorrectionFactorsSpect=new TCanvas
03603     ("cCorrectionFactorsSpect","cCorrectionFactorsSpect",
03604      0,0,1100,1000);
03605   cCorrectionFactorsSpect->SetFillColor(0);
03606   cCorrectionFactorsSpect->Divide(1,2);
03607   cCorrectionFactorsSpect->cd(1);
03608   hAttenCorSpect->Draw();
03609   hAttenCorSpect->SetTitle("Correction Factors");
03610   hAttenCorCalor->GetXaxis()->SetTitle("Correction Factor");
03611   hAttenCorCalor->GetXaxis()->SetRangeUser(0.2,2.5);
03612   hTotalCorSpect->Draw("SAMES");
03613   hGainCorSpect->Draw("SAMES");
03614   hAttenGreenCorSpect->Draw("SAMES");
03615   cCorrectionFactorsSpect->cd(2);
03616   TH1F* hSpect=static_cast<TH1F*>(hTotalCorSpect->Clone());
03617   hSpect->Draw();
03618   hSpect->Rebin(4);
03619   hSpect->GetXaxis()->SetRangeUser(0.2,2.5);
03620   hSpect->SetLineStyle(1);
03621   hSpect->SetLineColor(2);
03622   hSpect->SetLineWidth(3);
03623   hStsCorSpect->Draw("SAMES");
03624   hStsCorSpect->Rebin(4);
03625   hStsCorSpect->GetXaxis()->SetRangeUser(0.2,2.5);
03626   hStsCorSpect->SetLineStyle(5);
03627   hStsCorSpect->SetLineWidth(3);
03628 
03629 
03630 
03631 
03632   TCanvas* cCorrectionFactorsVsStrip=new TCanvas
03633     ("cCorrectionFactorsVsStrip","cCorrectionFactorsVsStrip",
03634      0,0,1100,1000);
03635   cCorrectionFactorsVsStrip->SetFillColor(0);
03636   cCorrectionFactorsVsStrip->Divide(2,2);
03637   cCorrectionFactorsVsStrip->cd(1);
03638   pAttenGreenCorVsStrip->Draw();
03639   cCorrectionFactorsVsStrip->cd(2);
03640   pTotalCorVsStrip->Draw();
03641   cCorrectionFactorsVsStrip->cd(3);
03642   pGainCorVsStrip->Draw();
03643   cCorrectionFactorsVsStrip->cd(4);
03644   pAttenCorVsStrip->Draw();
03645 
03646 
03647   TCanvas* cCorrectionFactorsVsStripU=new TCanvas
03648     ("cCorrectionFactorsVsStripU","cCorrectionFactorsVsStripU",
03649      0,0,1100,1000);
03650   cCorrectionFactorsVsStripU->SetFillColor(0);
03651   cCorrectionFactorsVsStripU->Divide(2,2);
03652   cCorrectionFactorsVsStripU->cd(1);
03653   pAttenGreenCorVsStripU->Draw();
03654   pAttenGreenCorVsStripU->SetTitle("Green Atten. Cor. Factor (U Planes)");
03655   pAttenGreenCorVsStripU->SetMinimum(0.8);
03656   pAttenGreenCorVsStripU->SetMaximum(2.0);
03657   cCorrectionFactorsVsStripU->cd(2);
03658   pTotalCorVsStripU->Draw();
03659   pTotalCorVsStripU->SetTitle("Total Correction Factor (U Planes)");
03660   pTotalCorVsStripU->SetMinimum(0.8);
03661   pTotalCorVsStripU->SetMaximum(2.0);
03662   cCorrectionFactorsVsStripU->cd(3);
03663   pGainCorVsStripU->Draw();
03664   pGainCorVsStripU->SetTitle("Gain Correction Factor (U Planes)");
03665   pGainCorVsStripU->SetMinimum(0.8);
03666   pGainCorVsStripU->SetMaximum(2.0);
03667   cCorrectionFactorsVsStripU->cd(4);
03668   pAttenCorVsStripU->Draw();
03669   pAttenCorVsStripU->SetTitle("Clear Atten. Correction Factor (U Planes)");
03670   pAttenCorVsStripU->SetMinimum(0.8);
03671   pAttenCorVsStripU->SetMaximum(2.0);
03672 
03673 
03674 
03675   TCanvas* cCorrectionFactorsVsStripV=new TCanvas
03676     ("cCorrectionFactorsVsStripV","cCorrectionFactorsVsStripV",
03677      0,0,1100,1000);
03678   cCorrectionFactorsVsStripV->SetFillColor(0);
03679   cCorrectionFactorsVsStripV->Divide(2,2);
03680   cCorrectionFactorsVsStripV->cd(1);
03681   pAttenGreenCorVsStripV->Draw();
03682   pAttenGreenCorVsStripV->SetTitle("Green Atten. Correction Factor (V Planes)");
03683   pAttenGreenCorVsStripV->SetMinimum(0.8);
03684   pAttenGreenCorVsStripV->SetMaximum(2.0);
03685   cCorrectionFactorsVsStripV->cd(2);
03686   pTotalCorVsStripV->Draw();
03687   pTotalCorVsStripV->SetTitle("Total Correction Factor (V Planes)");
03688   pTotalCorVsStripV->SetMinimum(0.8);
03689   pTotalCorVsStripV->SetMaximum(2.0);
03690   cCorrectionFactorsVsStripV->cd(3);
03691   pGainCorVsStripV->Draw();
03692   pGainCorVsStripV->SetTitle("Gain Correction Factor (V Planes)");
03693   pGainCorVsStripV->SetMinimum(0.8);
03694   pGainCorVsStripV->SetMaximum(2.0);
03695   cCorrectionFactorsVsStripV->cd(4);
03696   pAttenCorVsStripV->Draw();
03697   pAttenCorVsStripV->SetTitle("Clear Atten. Correction Factor (V Planes)");
03698   pAttenCorVsStripV->SetMinimum(0.8);
03699   pAttenCorVsStripV->SetMaximum(2.0);
03700 
03701   
03702 
03703 
03704   TCanvas* cClearFiber2=new TCanvas("cClearFiber2","cClearFiber2",
03705                                     0,0,1100,1000);
03706   cClearFiber2->SetFillColor(0);
03707   cClearFiber2->Divide(2,2);
03708   cClearFiber2->cd(1);
03709   TGraph* g=(TGraph*)gCfVsTAll->DrawClone("AP");
03710   g->SetTitle("Clear Fibre Lengths (U-View, FI & PI)");
03711   g->GetXaxis()->SetTitle("TPos (m)");
03712   g->GetXaxis()->CenterTitle();
03713   g->GetYaxis()->SetTitle("Clear fibre (m)");
03714   g->GetYaxis()->CenterTitle();
03715   gCfVsTUF->Draw("P");
03716   gCfVsTUP->Draw("P");
03717   gCfVsTUF->SetMarkerColor(2);
03718   cClearFiber2->cd(2);
03719   gCfVsTUP->Draw("AP");
03720   gCfVsTUP->SetTitle("Clear Fibre Lengths (U-View, PI)");
03721   gCfVsTUP->GetXaxis()->SetTitle("TPos (m)");
03722   gCfVsTUP->GetXaxis()->CenterTitle();
03723   gCfVsTUP->GetYaxis()->SetTitle("Clear fibre (m)");
03724   gCfVsTUP->GetYaxis()->CenterTitle();
03725   cClearFiber2->cd(3);
03726   g=(TGraph*)gCfVsTAll->DrawClone("AP");
03727   g->SetTitle("Clear Fibre Lengths (V-View, FI & PI)");
03728   g->GetXaxis()->SetTitle("TPos (m)");
03729   g->GetXaxis()->CenterTitle();
03730   g->GetYaxis()->SetTitle("Clear fibre (m)");
03731   g->GetYaxis()->CenterTitle();
03732   gCfVsTVF->Draw("P");
03733   gCfVsTVP->Draw("P");
03734   gCfVsTVF->SetMarkerColor(2);
03735   cClearFiber2->cd(4);
03736   gCfVsTVP->Draw("AP");
03737   gCfVsTVP->SetTitle("Clear Fibre Lengths (V-View, PI)");
03738   gCfVsTVP->GetXaxis()->SetTitle("TPos (m)");
03739   gCfVsTVP->GetXaxis()->CenterTitle();
03740   gCfVsTVP->GetYaxis()->SetTitle("Clear fibre (m)");
03741   gCfVsTVP->GetYaxis()->CenterTitle();
03742 
03743   
03744   TCanvas* cPigtails2=new TCanvas("cPigtails2","cPigtails2",
03745                                     0,0,1100,1000);
03746   cPigtails2->SetFillColor(0);
03747   cPigtails2->Divide(2,2);
03748   cPigtails2->cd(1);
03749   g=(TGraph*)gPtVsTAll->DrawClone("AP");
03750   g->SetTitle("Pigtail Lengths (U-View, FI & PI)");
03751   g->GetXaxis()->SetTitle("TPos (m)");
03752   g->GetXaxis()->CenterTitle();
03753   g->GetYaxis()->SetTitle("Pigtail (m)");
03754   g->GetYaxis()->CenterTitle();
03755   gPtVsTUF->Draw("P");
03756   gPtVsTUP->Draw("P");
03757   gPtVsTUF->SetMarkerColor(2);
03758   cPigtails2->cd(2);
03759   gPtVsTUP->Draw("AP");
03760   gPtVsTUP->SetTitle("Pigtail Lengths (U-View, PI)");
03761   gPtVsTUP->GetXaxis()->SetTitle("TPos (m)");
03762   gPtVsTUP->GetXaxis()->CenterTitle();
03763   gPtVsTUP->GetYaxis()->SetTitle("Pigtail (m)");
03764   gPtVsTUP->GetYaxis()->CenterTitle();
03765   cPigtails2->cd(3);
03766   g=(TGraph*)gPtVsTAll->DrawClone("AP");
03767   g->SetTitle("Pigtail Lengths (V-View, FI & PI)");
03768   g->GetXaxis()->SetTitle("TPos (m)");
03769   g->GetXaxis()->CenterTitle();
03770   g->GetYaxis()->SetTitle("Pigtail (m)");
03771   g->GetYaxis()->CenterTitle();
03772   gPtVsTVF->Draw("P");
03773   gPtVsTVP->Draw("P");
03774   gPtVsTVF->SetMarkerColor(2);
03775   cPigtails2->cd(4);
03776   gPtVsTVP->Draw("AP");
03777   gPtVsTVP->SetTitle("Pigtail Lengths (V-View, PI)");
03778   gPtVsTVP->GetXaxis()->SetTitle("TPos (m)");
03779   gPtVsTVP->GetXaxis()->CenterTitle();
03780   gPtVsTVP->GetYaxis()->SetTitle("Pigtail (m)");
03781   gPtVsTVP->GetYaxis()->CenterTitle();
03782 
03783 
03784   TCanvas* cHalfLengths2=new TCanvas("cHalfLengths2","cHalfLengths2",
03785                                     0,0,1100,1000);
03786   cHalfLengths2->SetFillColor(0);
03787   cHalfLengths2->Divide(2,2);
03788   cHalfLengths2->cd(1);
03789   g=(TGraph*)gHlVsTAll->DrawClone("AP");
03790   g->SetTitle("Half Lengths (U-View, FI & PI)");
03791   g->GetXaxis()->SetTitle("TPos (m)");
03792   g->GetXaxis()->CenterTitle();
03793   g->GetYaxis()->SetTitle("Half Lengths (m)");
03794   g->GetYaxis()->CenterTitle();
03795   gHlVsTUF->Draw("P");
03796   gHlVsTUP->Draw("P");
03797   gHlVsTUF->SetMarkerColor(2);
03798   cHalfLengths2->cd(2);
03799   gHlVsTUP->Draw("AP");
03800   gHlVsTUP->SetTitle("Half Lengths (U-View, PI)");
03801   gHlVsTUP->GetXaxis()->SetTitle("TPos (m)");
03802   gHlVsTUP->GetXaxis()->CenterTitle();
03803   gHlVsTUP->GetYaxis()->SetTitle("Half Lengths (m)");
03804   gHlVsTUP->GetYaxis()->CenterTitle();
03805   cHalfLengths2->cd(3);
03806   g=(TGraph*)gHlVsTAll->DrawClone("AP");
03807   g->SetTitle("Half Lengths (V-View, FI & PI)");
03808   g->GetXaxis()->SetTitle("TPos (m)");
03809   g->GetXaxis()->CenterTitle();
03810   g->GetYaxis()->SetTitle("Half Lengths (m)");
03811   g->GetYaxis()->CenterTitle();
03812   gHlVsTVF->Draw("P");
03813   gHlVsTVP->Draw("P");
03814   gHlVsTVF->SetMarkerColor(2);
03815   cHalfLengths2->cd(4);
03816   gHlVsTVP->Draw("AP");
03817   gHlVsTVP->SetTitle("Half Lengths (V-View, PI)");
03818   gHlVsTVP->GetXaxis()->SetTitle("TPos (m)");
03819   gHlVsTVP->GetXaxis()->CenterTitle();
03820   gHlVsTVP->GetYaxis()->SetTitle("Half Lengths (m)");
03821   gHlVsTVP->GetYaxis()->CenterTitle();
03822 
03823 
03824   
03825   TPolyLine* oU;
03826   TPolyLine* iU;
03827   TPolyLine* oFU;
03828   TPolyLine* iFU;
03829   TPolyLine* oV;
03830   TPolyLine* iV;
03831   TPolyLine* oFV;
03832   TPolyLine* iFV;
03833   PlaneOutline po;
03834   po.GetOutline(PlaneView::kU,PlaneCoverage::kNearPartial,
03835                 oU,iU);
03836   po.GetOutline(PlaneView::kU,PlaneCoverage::kNearFull,
03837                 oFU,iFU);
03838   po.GetOutline(PlaneView::kV,PlaneCoverage::kNearPartial,
03839                 oV,iV);
03840   po.GetOutline(PlaneView::kV,PlaneCoverage::kNearFull,
03841                 oFV,iFV);
03842 
03843   oV->SetLineColor(14);
03844   oV->SetLineWidth(2);
03845   oU->SetLineWidth(2);
03846 
03847   oFV->SetLineColor(2);
03848   iFV->SetLineColor(2);
03849   oFV->SetLineStyle(2);
03850   iFV->SetLineStyle(2);
03851 
03852   oFU->SetLineColor(2);
03853   iFU->SetLineColor(2);
03854   oFU->SetLineStyle(3);
03855   iFU->SetLineStyle(3);
03856 
03857   Int_t lineWidth=5;
03858   TGraph* readoutU2=new TGraph(3);
03859   readoutU2->SetLineWidth(lineWidth);
03860   readoutU2->SetLineColor(6);
03861   readoutU2->SetPoint(0,2.87,0.83);
03862   readoutU2->SetPoint(1,2.87,-0.82);
03863   readoutU2->SetPoint(2,1.7,-2.0);
03864 
03865   TGraph* readoutV2=new TGraph(3);
03866   readoutV2->SetLineWidth(lineWidth);
03867   readoutV2->SetLineColor(6);
03868   readoutV2->SetPoint(0,2.87,-0.82);
03869   readoutV2->SetPoint(1,2.87,0.83);
03870   readoutV2->SetPoint(2,1.68,2.0);
03871 
03872   TGraph* uStrip=new TGraph(2);
03873   uStrip->SetLineWidth(2);
03874   uStrip->SetPoint(0,2.87,-0.83);
03875   uStrip->SetPoint(1,0.86,1.23);
03876 
03877   TGraph* vStrip=new TGraph(2);
03878   vStrip->SetLineWidth(2);
03879   vStrip->SetPoint(1,2.87,0.83);
03880   vStrip->SetPoint(0,0.86,-1.23);
03881   
03882   TCanvas* cCentres=new TCanvas("cCentres","cCentres",
03883                                     0,0,1100,1000);
03884   cCentres->SetFillColor(0);
03885   cCentres->Divide(2,2);
03886   cCentres->cd(1);
03887   g=(TGraph*)gCentreAll->DrawClone("AP");
03888   g->SetTitle("Strip Centres (U-View, FI & PI)");
03889   g->GetXaxis()->SetTitle("X (m)");
03890   g->GetXaxis()->CenterTitle();
03891   g->GetYaxis()->SetTitle("Y (m)");
03892   g->GetYaxis()->CenterTitle();
03893   gCentreUF->Draw("P");
03894   gCentreUP->Draw("P");
03895   gCentreUF->SetMarkerColor(2);
03896   //draw the outlines
03897   oU->Draw();
03898   oFU->Draw();
03899   iFU->Draw();
03900   oV->Draw();
03901   oFV->Draw();
03902   iFV->Draw();
03903   readoutU2->Draw();
03904   uStrip->Draw();
03905   cCentres->cd(2);
03906   gCentreUP->Draw("AP");
03907   gCentreUP->SetTitle("Strip Centres (U-View, PI)");
03908   gCentreUP->GetXaxis()->SetTitle("X (m)");
03909   gCentreUP->GetXaxis()->CenterTitle();
03910   gCentreUP->GetYaxis()->SetTitle("Y (m)");
03911   gCentreUP->GetYaxis()->CenterTitle();
03912   cCentres->cd(3);
03913   g=(TGraph*)gCentreAll->DrawClone("AP");
03914   g->SetTitle("Strip Centres (V-View, FI & PI)");
03915   g->GetXaxis()->SetTitle("X (m)");
03916   g->GetXaxis()->CenterTitle();
03917   g->GetYaxis()->SetTitle("Y (m)");
03918   g->GetYaxis()->CenterTitle();
03919   gCentreVF->Draw("P");
03920   gCentreVP->Draw("P");
03921   gCentreVF->SetMarkerColor(2);
03922   oU->Draw();
03923   oFU->Draw();
03924   iFU->Draw();
03925   oV->Draw();
03926   oFV->Draw();
03927   iFV->Draw();
03928   readoutV2->Draw();
03929   vStrip->Draw();
03930   cCentres->cd(4);
03931   gCentreVP->Draw("AP");
03932   gCentreVP->SetTitle("Strip Centres (V-View, PI)");
03933   gCentreVP->GetXaxis()->SetTitle("X (m)");
03934   gCentreVP->GetXaxis()->CenterTitle();
03935   gCentreVP->GetYaxis()->SetTitle("Y (m)");
03936   gCentreVP->GetYaxis()->CenterTitle();
03937   
03938 
03939   
03940   Float_t min2=0;
03941   Float_t max2=7;
03942   Bool_t doFit=false;
03943   TCanvas* cClearFiber=new TCanvas("cClearFiber","cClearFiber",
03944                                    0,0,1100,1000);
03945   cClearFiber->SetFillColor(0);
03946   cClearFiber->Divide(2,2);
03947   cClearFiber->cd(1);
03948   pCfVsTU1->Draw("rms");
03949   pCfVsTU1->SetTitle("ClearFiber vs TPos (U-View, East side)");
03950   pCfVsTU1->GetXaxis()->SetTitle("TPos (m)");
03951   pCfVsTU1->GetXaxis()->CenterTitle();
03952   pCfVsTU1->GetYaxis()->SetTitle("ClearFiber (m)");
03953   pCfVsTU1->GetYaxis()->CenterTitle();
03954   //pCfVsTU1->GetYaxis()->SetTitleOffset(1.3);
03955   if (doFit) pCfVsTU1->Fit("pol1");
03956   pCfVsTU1->SetMinimum(min2);
03957   pCfVsTU1->SetMaximum(max2);
03958   cClearFiber->cd(2);
03959   pCfVsTU2->Draw("rms");
03960   pCfVsTU2->SetTitle("ClearFiber vs TPos (U-View, West side)");
03961   pCfVsTU2->GetXaxis()->SetTitle("TPos (m)");
03962   pCfVsTU2->GetXaxis()->CenterTitle();
03963   pCfVsTU2->GetYaxis()->SetTitle("ClearFiber (m)");
03964   pCfVsTU2->GetYaxis()->CenterTitle();
03965   //pCfVsTU2->GetYaxis()->SetTitleOffset(1.3);
03966   if (doFit) pCfVsTU2->Fit("pol1");
03967   pCfVsTU2->SetMinimum(min2);
03968   pCfVsTU2->SetMaximum(max2);
03969   cClearFiber->cd(3);
03970   pCfVsTV1->Draw("rms");
03971   pCfVsTV1->SetTitle("ClearFiber vs TPos (V-View, East side)");
03972   pCfVsTV1->GetXaxis()->SetTitle("TPos (m)");
03973   pCfVsTV1->GetXaxis()->CenterTitle();
03974   pCfVsTV1->GetYaxis()->SetTitle("ClearFiber (m)");
03975   pCfVsTV1->GetYaxis()->CenterTitle();
03976   //pCfVsTV1->GetYaxis()->SetTitleOffset(1.3);
03977   if (doFit) pCfVsTV1->Fit("pol1");
03978   pCfVsTV1->SetMinimum(min2);
03979   pCfVsTV1->SetMaximum(max2);
03980   cClearFiber->cd(4);
03981   pCfVsTV2->Draw("rms");
03982   pCfVsTV2->SetTitle("ClearFiber vs TPos (V-View, West side)");
03983   pCfVsTV2->GetXaxis()->SetTitle("TPos (m)");
03984   pCfVsTV2->GetXaxis()->CenterTitle();
03985   pCfVsTV2->GetYaxis()->SetTitle("ClearFiber (m)");
03986   pCfVsTV2->GetYaxis()->CenterTitle();
03987   //pCfVsTV2->GetYaxis()->SetTitleOffset(1.3);
03988   if (doFit) pCfVsTV2->Fit("pol1");
03989   pCfVsTV2->SetMinimum(min2);
03990   pCfVsTV2->SetMaximum(max2);
03991 
03992 
03993   TCanvas* cPigtails=new TCanvas("cPigtails","cPigtails",
03994                                  0,0,1100,1000);
03995   cPigtails->SetFillColor(0);
03996   cPigtails->Divide(2,2);
03997   cPigtails->cd(1);
03998   pPtVsTU1->Draw("rms");
03999   pPtVsTU1->SetTitle("Pigtail vs TPos (U-View, East side)");
04000   pPtVsTU1->GetXaxis()->SetTitle("TPos (m)");
04001   pPtVsTU1->GetXaxis()->CenterTitle();
04002   pPtVsTU1->GetYaxis()->SetTitle("Pigtail (m)");
04003   pPtVsTU1->GetYaxis()->CenterTitle();
04004   //pPtVsTU1->GetYaxis()->SetTitleOffset(1.3);
04005   if (doFit) pPtVsTU1->Fit("pol1");
04006   //pPtVsTU1->SetMinimum(min2);
04007   //pPtVsTU1->SetMaximum(max2);
04008   cPigtails->cd(2);
04009   pPtVsTU2->Draw("rms");
04010   pPtVsTU2->SetTitle("Pigtail vs TPos (U-View, West side)");
04011   pPtVsTU2->GetXaxis()->SetTitle("TPos (m)");
04012   pPtVsTU2->GetXaxis()->CenterTitle();
04013   pPtVsTU2->GetYaxis()->SetTitle("Pigtail (m)");
04014   pPtVsTU2->GetYaxis()->CenterTitle();
04015   //pPtVsTU2->GetYaxis()->SetTitleOffset(1.3);
04016   if (doFit) pPtVsTU2->Fit("pol1");
04017   //pPtVsTU2->SetMinimum(min2);
04018   //pPtVsTU2->SetMaximum(max2);
04019   cPigtails->cd(3);
04020   pPtVsTV1->Draw("rms");
04021   pPtVsTV1->SetTitle("Pigtail vs TPos (V-View, East side)");
04022   pPtVsTV1->GetXaxis()->SetTitle("TPos (m)");
04023   pPtVsTV1->GetXaxis()->CenterTitle();
04024   pPtVsTV1->GetYaxis()->SetTitle("Pigtail (m)");
04025   pPtVsTV1->GetYaxis()->CenterTitle();
04026   //pPtVsTV1->GetYaxis()->SetTitleOffset(1.3);
04027   if (doFit) pPtVsTV1->Fit("pol1");
04028   //pPtVsTV1->SetMinimum(min2);
04029   //pPtVsTV1->SetMaximum(max2);
04030   cPigtails->cd(4);
04031   pPtVsTV2->Draw("rms");
04032   pPtVsTV2->SetTitle("Pigtail vs TPos (V-View, West side)");
04033   pPtVsTV2->GetXaxis()->SetTitle("TPos (m)");
04034   pPtVsTV2->GetXaxis()->CenterTitle();
04035   pPtVsTV2->GetYaxis()->SetTitle("Pigtail (m)");
04036   pPtVsTV2->GetYaxis()->CenterTitle();
04037   //pPtVsTV2->GetYaxis()->SetTitleOffset(1.3);
04038   if (doFit) pPtVsTV2->Fit("pol1");
04039   //pPtVsTV2->SetMinimum(min2);
04040   //pPtVsTV2->SetMaximum(max2);
04041 
04042 
04043   TCanvas* cHalfLength=new TCanvas("cHalfLength","cHalfLength",
04044                                    0,0,1100,1000);
04045   cHalfLength->SetFillColor(0);
04046   cHalfLength->Divide(2,2);
04047   cHalfLength->cd(1);
04048   pHlVsTU1->Draw("rms");
04049   pHlVsTU1->SetTitle("HalfLength vs TPos (U-View, East side)");
04050   pHlVsTU1->GetXaxis()->SetTitle("TPos (m)");
04051   pHlVsTU1->GetXaxis()->CenterTitle();
04052   pHlVsTU1->GetYaxis()->SetTitle("HalfLength (m)");
04053   pHlVsTU1->GetYaxis()->CenterTitle();
04054   //pHlVsTU1->GetYaxis()->SetTitleOffset(1.3);
04055   if (doFit) pHlVsTU1->Fit("pol1");
04056   //pHlVsTU1->SetMinimum(min2);
04057   //pHlVsTU1->SetMaximum(max2);
04058   cHalfLength->cd(2);
04059   pHlVsTU2->Draw("rms");
04060   pHlVsTU2->SetTitle("HalfLength vs TPos (U-View, West side)");
04061   pHlVsTU2->GetXaxis()->SetTitle("TPos (m)");
04062   pHlVsTU2->GetXaxis()->CenterTitle();
04063   pHlVsTU2->GetYaxis()->SetTitle("HalfLength (m)");
04064   pHlVsTU2->GetYaxis()->CenterTitle();
04065   //pHlVsTU2->GetYaxis()->SetTitleOffset(1.3);
04066   if (doFit) pHlVsTU2->Fit("pol1");
04067   //pHlVsTU2->SetMinimum(min2);
04068   //pHlVsTU2->SetMaximum(max2);
04069   cHalfLength->cd(3);
04070   pHlVsTV1->Draw("rms");
04071   pHlVsTV1->SetTitle("HalfLength vs TPos (V-View, East side)");
04072   pHlVsTV1->GetXaxis()->SetTitle("TPos (m)");
04073   pHlVsTV1->GetXaxis()->CenterTitle();
04074   pHlVsTV1->GetYaxis()->SetTitle("HalfLength (m)");
04075   pHlVsTV1->GetYaxis()->CenterTitle();
04076   //pHlVsTV1->GetYaxis()->SetTitleOffset(1.3);
04077   if (doFit) pHlVsTV1->Fit("pol1");
04078   //pHlVsTV1->SetMinimum(min2);
04079   //pHlVsTV1->SetMaximum(max2);
04080   cHalfLength->cd(4);
04081   pHlVsTV2->Draw("rms");
04082   pHlVsTV2->SetTitle("HalfLength vs TPos (V-View, West side)");
04083   pHlVsTV2->GetXaxis()->SetTitle("TPos (m)");
04084   pHlVsTV2->GetXaxis()->CenterTitle();
04085   pHlVsTV2->GetYaxis()->SetTitle("HalfLength (m)");
04086   pHlVsTV2->GetYaxis()->CenterTitle();
04087   //pHlVsTV2->GetYaxis()->SetTitleOffset(1.3);
04088   if (doFit) pHlVsTV2->Fit("pol1");
04089   //pHlVsTV2->SetMinimum(min2);
04090   //pHlVsTV2->SetMaximum(max2);
04091 
04092   //put this at the end to "deselect" the current pad
04093   gPad->SetBorderMode(0);
04094 
04095   cout<<"End of macro"<<endl;
04096 }

void MeuPlots::WriteOutHistos (  )  const

Definition at line 128 of file MeuPlots.cxx.

References fOutFile, Msg::kInfo, Msg::kWarning, and MSG.

00129 {
00130   //write out the histos to the file, if it's open
00131   if (fOutFile){
00132     if (fOutFile->IsWritable()){
00133       fOutFile->cd();
00134 
00135       //create a tree and set branches      
00136       //TTree runInfo("runInfo","runInfo");
00137       //Int_t lSimFlag=0;
00138       //runInfo.Branch("SimFlag",&lSimFlag,"SimFlag/I");
00139 
00140       //fill and write      
00141       //runInfo.Fill();
00142       //runInfo.Write();
00143       
00144       MSG("MeuPlots",Msg::kInfo)
00145         <<"Writing histos to: "<<fOutFile->GetName()<<" ..."<<endl;
00146       fOutFile->Write();
00147       //fOutFile->Close();//this makes histos disappear from canvases
00148       //so do it in the destructor (need to make MeuPlots on heap)
00149     }
00150     else {
00151       MSG("MeuPlots",Msg::kWarning)
00152         <<"File not writable!"<<endl;
00153     }
00154   }
00155 }


Member Data Documentation

TChain* MeuPlots::fChain [private]

Definition at line 94 of file MeuPlots.h.

Referenced by MakeChain(), MeuPlots(), SetLoopVariables(), and SetRootFileObjects().

Int_t MeuPlots::fEntries [private]
string MeuPlots::fInputFileName = "" [static, private]

Definition at line 73 of file MeuPlots.h.

Referenced by MakeFileList().

Definition at line 95 of file MeuPlots.h.

Referenced by MeuPlots(), and SetRootFileObjects().

TFile* MeuPlots::fOutFile [private]
Int_t MeuPlots::fRunNumber [private]

Definition at line 92 of file MeuPlots.h.

Referenced by MakeValidationPlots(), MeuPlots(), and SetRootFileObjects().

std::string MeuPlots::fS [private]

Definition at line 97 of file MeuPlots.h.

Referenced by FNALSep04(), MeuPlots(), and MeuSystematics().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1