Gryfindor_one.cxx File Reference

#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "TFile.h"
#include "TROOT.h"
#include "TH1.h"
#include "TF1.h"
#include "TH2.h"
#include "TF2.h"
#include "TH3.h"
#include "TStyle.h"
#include "TApplication.h"
#include "TCanvas.h"
#include "TMath.h"
#include "TMinuit.h"
#include "TNtuple.h"
#include "TLatex.h"
#include "TLine.h"
#include "TFrame.h"
#include "TEllipse.h"
#include "detector/detector.h"

Go to the source code of this file.

Functions

TROOT simple ("stuff","stuff")
void DrawFourPlanes (Detector *detector_one, Detector *detector_two, Int_t start_plane, Int_t led)
int SanityCheck (int plane, int chip, int channel)
int GetPixel (int channel)
Int_t main (Int_t argv, char **argc)

Function Documentation

void DrawFourPlanes ( Detector detector_one,
Detector detector_two,
Int_t  start_plane,
Int_t  led 
)

Definition at line 171 of file Gryfindor_one.cxx.

References boxes, fourplanes, Detector::GetPixelMean(), Detector::GetPixelRMS(), pixels, plane_lims, plane_one_east, plane_one_west, plane_two_east, plane_two_west, pmts, and strip_starts.

00171                                                                                                 {
00172   TCanvas *fourplanes = new TCanvas("fourplanes","fourplanes",0,0,600,750);
00173   TVirtualPad *pixels[4][3][16];
00174   TVirtualPad *pmts[4][3];
00175   TVirtualPad *boxes[4];
00176   
00177   boxes[3] = new TPad("box_0","box_0",0.10,0.01,0.99,0.20,19);
00178   boxes[2] = new TPad("box_0","box_0",0.10,0.26,0.99,0.45,19);
00179   boxes[1] = new TPad("box_0","box_0",0.10,0.51,0.99,0.70,19);
00180   boxes[0] = new TPad("box_0","box_0",0.10,0.76,0.99,0.95,19);
00181   
00182   boxes[0]->Draw();
00183   boxes[1]->Draw();
00184   boxes[2]->Draw();
00185   boxes[3]->Draw();
00186   
00187   boxes[0]->Divide(3,1);
00188   boxes[1]->Divide(3,1);
00189   boxes[2]->Divide(3,1);
00190   boxes[3]->Divide(3,1);
00191   
00192   for(Int_t i=0;i<4;i++){
00193     for(Int_t j=0;j<3;j++){
00194       boxes[i]->cd(j+1);
00195       pmts[i][j] = gPad;
00196       pmts[i][j]->Divide(4,4);
00197       for(Int_t k=0;k<16;k++){
00198         pmts[i][j]->cd(k+1);
00199         pixels[i][j][k]=gPad;
00200       }
00201     }
00202   }
00203 
00204   for(Int_t strip = strip_starts[led-1];strip < (strip_starts[led-1]+plane_lims[led-1]);strip++){
00205     
00206     pixels[0][(plane_one_east[strip]-1)/16][(plane_one_east[strip]-1)%16]->SetFillColor(4);
00207     pixels[1][(plane_one_east[strip]-1)/16][(plane_one_east[strip]-1)%16]->SetFillColor(4);
00208     pixels[2][(plane_one_west[strip]-1)/16][(plane_one_west[strip]-1)%16]->SetFillColor(4);
00209     pixels[3][(plane_one_west[strip]-1)/16][(plane_one_west[strip]-1)%16]->SetFillColor(4);
00210   }
00211   int switched_led;
00212   switched_led = (led-1)-1;
00213   if(switched_led <0) switched_led =19;
00214   
00215   for(Int_t strip = strip_starts[switched_led];strip < (strip_starts[switched_led]+plane_lims[switched_led]);strip++){
00216     pixels[0][(plane_two_east[strip]-1)/16][(plane_two_east[strip]-1)%16]->SetFillColor(4);
00217     pixels[1][(plane_two_east[strip]-1)/16][(plane_two_east[strip]-1)%16]->SetFillColor(4);
00218     pixels[2][(plane_two_west[strip]-1)/16][(plane_two_west[strip]-1)%16]->SetFillColor(4);
00219     pixels[3][(plane_two_west[strip]-1)/16][(plane_two_west[strip]-1)%16]->SetFillColor(4);
00220   }
00221   
00222   
00223   Double_t mean;
00224 
00225   TEllipse *markers[4][3][16]={0};
00226 
00227   for(Int_t plane=0;plane<4;plane++){
00228     for(Int_t pmt = 0; pmt < 3; pmt++){
00229       for(Int_t pixel =0; pixel<16; pixel++){
00230         mean =  detector_one->GetPixelMean(0,start_plane+plane,pmt,pixel);
00231         if(mean > 0){
00232           if(plane%2!=0){
00233             pixels[0][pmt][pixel]->cd();
00234             markers[0][pmt][pixel] = new TEllipse(0.5,0.5,((mean/16000.0)/2.0),((mean/16000.0)/2.0));
00235             markers[0][pmt][pixel]->SetFillColor(1);
00236             markers[0][pmt][pixel]->Draw();
00237           }
00238           else{
00239             pixels[1][pmt][pixel]->cd();
00240             markers[1][pmt][pixel] = new TEllipse(0.5,0.5,((mean/16000.0)/2.0),((mean/16000.0)/2.0));
00241             markers[1][pmt][pixel]->SetFillColor(1);
00242             markers[1][pmt][pixel]->Draw();
00243           }
00244         }
00245       }
00246     }
00247   }
00248 
00249 
00250   Double_t npe;
00251   Double_t rms;
00252 
00253   for(Int_t plane=0;plane<4;plane++){
00254     for(Int_t pmt = 0; pmt < 3; pmt++){
00255       for(Int_t pixel =0; pixel<16; pixel++){
00256         mean =  detector_two->GetPixelMean(1,start_plane+plane,pmt,pixel);
00257         rms =  detector_two->GetPixelRMS(1,start_plane+plane,pmt,pixel);
00258         if(mean > 0){
00259           //      npe = pow(rms/mean,2);
00260           if(plane%2!=0){
00261             pixels[2][pmt][pixel]->cd();
00262             markers[2][pmt][pixel] = new TEllipse(0.5,0.5,((mean/16000.0)/2.0),((mean/16000.0)/2.0));
00263             markers[2][pmt][pixel]->SetFillColor(1);
00264             markers[2][pmt][pixel]->Draw();
00265           }
00266           else{
00267             pixels[3][pmt][pixel]->cd();
00268             markers[3][pmt][pixel] = new TEllipse(0.5,0.5,((mean/16000.0)/2.0),((mean/16000.0)/2.0));
00269             markers[3][pmt][pixel]->SetFillColor(1);
00270             markers[3][pmt][pixel]->Draw();
00271           }
00272         }
00273       }
00274     }
00275   }
00276   fourplanes->Update();
00277 };

int GetPixel ( int  channel  ) 
Int_t main ( Int_t  argv,
char **  argc 
)

Definition at line 38 of file Gryfindor_one.cxx.

References DrawFourPlanes(), infile, and Detector::SetStats().

00039 {
00040   TApplication *theApp=new TApplication("App", &argv, argc);
00041   
00042   TFile *infile = new TFile("drift.root");
00043 
00044   TTree *li_tree = (TTree*) infile->Get("li_tree");
00045 
00046   Int_t calibpoint;
00047   Int_t pulserbox;
00048   Int_t led;
00049   Int_t pulse_height;
00050   Int_t pulse_width;
00051   Int_t period;
00052   Int_t calibtype;
00053   Int_t timestamp;
00054   Int_t pulses;
00055 
00056   Int_t crate;
00057   Int_t chAdd;
00058   Int_t vaarc;
00059   Int_t vmm;
00060   Int_t vaadc;
00061   
00062   Int_t plane;
00063   Int_t chip;
00064   Int_t channel;
00065  
00066   Double_t mean;
00067   Double_t rms;
00068 
00069   Int_t no_entries;
00070 
00071   li_tree->SetBranchAddress("calibpoint",&calibpoint);
00072   li_tree->SetBranchAddress("pulserbox",&pulserbox);
00073   li_tree->SetBranchAddress("led",&led);
00074   li_tree->SetBranchAddress("pulse_height",&pulse_height);
00075   li_tree->SetBranchAddress("pulse_width",&pulse_width);
00076   li_tree->SetBranchAddress("period",&period);
00077   li_tree->SetBranchAddress("calibtype",&calibtype);
00078   li_tree->SetBranchAddress("pulses",&pulses);
00079   li_tree->SetBranchAddress("timestamp",&timestamp);
00080 
00081   li_tree->SetBranchAddress("crate",&crate);
00082   li_tree->SetBranchAddress("chAdd",&chAdd);
00083   li_tree->SetBranchAddress("vaarc",&vaarc);
00084   li_tree->SetBranchAddress("vmm",&vmm);
00085   li_tree->SetBranchAddress("vaadc",&vaadc);
00086 
00087   li_tree->SetBranchAddress("plane",&plane);
00088   li_tree->SetBranchAddress("chip",&chip);
00089   li_tree->SetBranchAddress("channel",&channel);
00090 
00091   li_tree->SetBranchAddress("no_entries",&no_entries);
00092   li_tree->SetBranchAddress("mean",&mean);
00093   li_tree->SetBranchAddress("rms",&rms);
00094 
00095   Stat_t no_events = li_tree->GetEntries();
00097   
00098   Detector *detector[4][21]={0};
00099   Double_t progress_percentage;
00100   progress_percentage=0;
00101  
00102   cout << endl;
00103   cout <<  " *************************************** " << endl;
00104   cout <<  " ** Initialised objects to hold data  ** " << endl;
00105   cout <<  " **         Reading in data           ** " << endl;
00106   cout <<  " **  0%------------------------100%   ** " << endl;
00107   cout <<  " **  ";
00108   
00109   for(Int_t index = 0; index<no_events;index++){
00110     li_tree->GetEntry(index);
00111     
00112     if(detector[pulserbox][21-led] ==0)
00113       detector[pulserbox][21-led] = new Detector();
00114     
00115     if(plane > 0)
00116       detector[pulserbox][21-led]->SetStats(crate%2,plane,chip,channel,no_entries,mean,rms);
00117     if( (index/no_events) > (progress_percentage+0.1) ){
00118       cout << "***";
00119       progress_percentage = index/no_events;
00120     }
00121   }
00122   cout << "***";
00123   cout <<  "   ** " << endl;
00124   cout <<  " *************************************** " << endl;
00125   cout <<  endl;
00126 
00128   // Now posses objects with all channel  //
00129   // pulsing details for all channels     //
00131 
00132   
00133   Int_t pick_led;
00134   Int_t led_pattern;
00135   Int_t start_plane;
00136   pick_led =1;
00137   int pulser_pick=0;
00138   cout << " Which 4 plane number? (ie 1,5,9,13...) : " ;
00139   cin >> start_plane;
00140  
00141   
00142   
00143   
00144   while(pick_led > 0){
00145     cout << " Which led No      : ";
00146     cin >> pick_led;
00147     cout << " Which led pattern : ";
00148     cin >> led_pattern;
00149     if(start_plane < 65)
00150       DrawFourPlanes(detector[1][pick_led],detector[1][pick_led],start_plane,led_pattern);
00151     else if(start_plane >64 && start_plane < 129)
00152       DrawFourPlanes(detector[3][pick_led],detector[3][pick_led],start_plane,led_pattern);
00153     else if(start_plane >129 && start_plane < 193)
00154       DrawFourPlanes(detector[5][pick_led],detector[5][pick_led],start_plane,led_pattern);
00155     else if(start_plane >192 && start_plane < 256)
00156       DrawFourPlanes(detector[7][pick_led],detector[7][pick_led],start_plane,led_pattern);
00157   }
00158   
00159   
00160   
00161   
00162   
00163 
00164   theApp->Run(kTRUE);
00165 }

int SanityCheck ( int  plane,
int  chip,
int  channel 
)

Definition at line 281 of file Gryfindor_one.cxx.

00281                                                 {
00282    if(plane < 1 || plane > 248)
00283     return 0;
00284   if(chip < 0 || chip > 2)
00285     return 0;
00286   if(channel <0 || channel > 22)
00287     return 0;
00288   return 1;
00289 }

TROOT simple ( "stuff"  ,
"stuff"   
)

Generated on 15 Jul 2018 for loon by  doxygen 1.6.1