Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Gryfindor/detector/detector.cxx

Go to the documentation of this file.
00001 /***************************************************************************
00002                           detector.cpp  -  description
00003                              -------------------
00004     begin                : Sun Feb 10 2002
00005     copyright            : (C) 2002 by Robert Morse
00006     email                : r.morse@sussex.ac.uk
00007  ***************************************************************************/
00008 
00009 
00010 #include "detector.h"
00011 
00012 
00013 Int_t Detector::FillStripHist(Int_t box,Int_t led,Int_t side,TH2F *ratiohist){
00014 
00015 
00016   if(sides[side]!=0){
00017     sides[side]->FillStripHist(box,led,ratiohist);
00018   }
00019   else
00020     return 0;
00021   return 1;
00022 };
00023 
00024 
00025 void Detector::RemoveDemons(Int_t box,Int_t led){
00026   for(Int_t n=0;n<2;n++)
00027     if(sides[n]!=0)
00028       sides[n]->RemoveDemons(box,led);
00029 };
00030 
00031 void Detector::FillMeanHist(TH1F *meanhist){
00032   for(Int_t n=0;n<2;n++)
00033     if(sides[n]!=0)
00034       sides[n]->FillMeanHist(meanhist);
00035 
00036 };
00037 
00038 Detector::Detector(){
00039   for(Int_t n=0;n<2;n++)
00040     sides[n]=0;
00041 
00042 };
00043 
00044 void  Detector::Clean(){
00045   for(Int_t n=0;n<2;n++){
00046     if(sides[n] != 0)
00047       sides[n]->Clean();
00048   }
00049 };
00050 
00051 void  Detector::AddStats(Int_t in_side,Int_t in_plane, Int_t in_chip, Int_t in_channel,Int_t new_entries, Double_t new_mean, Double_t new_rms){
00052   if(sides[in_side] == 0)
00053     sides[in_side]=new Side(in_side);
00054   sides[in_side]->AddStats(in_plane,in_chip,in_channel,new_entries,new_mean,new_rms);
00055 };
00056 
00057 void  Detector::SetStats(Int_t in_side,Int_t in_plane, Int_t in_chip, Int_t in_channel,Int_t new_entries, Double_t new_mean, Double_t new_rms){
00058   // cout << " here " << in_side << "\t" << in_plane << "\t" << in_chip << "\t" << in_channel <<endl;
00059   if(sides[in_side] == 0)
00060     sides[in_side]=new Side(in_side);
00061 
00062   sides[in_side]->SetStats(in_plane,in_chip,in_channel,new_entries,new_mean,new_rms);
00063 }
00064 
00065 
00066 Int_t  Detector::GetEntries(Int_t in_side,Int_t in_plane,Int_t in_chip, Int_t in_channel){
00067   if(sides[in_side] != 0)
00068     return sides[in_side]->GetEntries(in_plane,in_chip,in_channel);
00069   return 0;
00070 };
00071 
00072 Double_t  Detector::GetMean(Int_t in_side, Int_t in_plane,Int_t in_chip, Int_t in_channel){
00073   if(sides[in_side] != 0)
00074     return sides[in_side]->GetMean(in_plane,in_chip,in_channel);
00075   return 0;
00076 };
00077 
00078 Double_t  Detector::GetRMS(Int_t in_side, Int_t in_plane,Int_t in_chip, Int_t in_channel){
00079   if(sides[in_side] != 0)
00080     return sides[in_side]->GetRMS(in_plane,in_chip,in_channel);
00081   return 0;
00082 };
00083 
00084 void Detector::FillChipHist(Int_t side,TH2F *chiphist){
00085         if(sides[side]!=0)
00086                 sides[side]->FillChipHist(chiphist);
00087 
00088 }
00089 
00090 Double_t Detector::GetPinMean(Int_t box, Int_t led, Int_t level){
00091 if(box ==0){
00092         if(level == 0){
00093                 return  GetMean(0,pin_locations_low_0[led],0,18);
00094         }
00095         if(level == 1)
00096                 return  GetMean(0,pin_locations_high_0[led],1,18);
00097 }
00098 if(box ==1){
00099         if(level == 0){
00100                 return  GetMean(1,pin_locations_low_1[led],0,18);
00101         }
00102         if(level == 1)
00103                 return  GetMean(1,pin_locations_high_1[led],1,18);
00104 }
00105 
00106 if(box ==2){
00107         if(level == 0){
00108                 return  GetMean(0,pin_locations_low_2[led],0,18);
00109         }
00110         if(level == 1)
00111                 return  GetMean(0,pin_locations_high_2[led],1,18);
00112 }
00113 if(box ==3){
00114         if(level == 0){
00115                 return  GetMean(1,pin_locations_low_3[led],0,18);
00116         }
00117         if(level == 1)
00118                 return  GetMean(1,pin_locations_high_3[led],1,18);
00119 }
00120 
00121 return 0;
00122 }
00123 
00124 Double_t Detector::GetPinRMS(Int_t box, Int_t led, Int_t level){
00125 
00126 if(box ==0){
00127         if(level == 0){
00128                         return  GetRMS(0,pin_locations_low_0[led],0,18);
00129         }
00130         if(level == 1)
00131                 return  GetRMS(0,pin_locations_high_0[led],1,18);
00132 }
00133 
00134 if(box ==1){
00135         if(level == 0){
00136                         return  GetRMS(1,pin_locations_low_1[led],0,18);
00137         }
00138         if(level == 1)
00139                 return  GetRMS(1,pin_locations_high_1[led],1,18);
00140 }
00141 
00142 if(box ==2){
00143         if(level == 0){
00144                         return  GetRMS(0,pin_locations_low_2[led],0,18);
00145         }
00146         if(level == 1)
00147                 return  GetRMS(0,pin_locations_high_2[led],1,18);
00148 }
00149 
00150 if(box ==3){
00151         if(level == 0){
00152                         return  GetRMS(1,pin_locations_low_3[led],0,18);
00153         }
00154         if(level == 1)
00155                 return  GetRMS(1,pin_locations_high_3[led],1,18);
00156 }
00157 
00158 return 0;
00159 }
00160 
00161 
00162 
00163 
00164 Int_t Detector::GetPinEntries(Int_t box, Int_t led, Int_t level){
00165 
00166 if(box ==0){
00167         if(level == 0){
00168                         return  GetEntries(0,pin_locations_low_0[led],0,18);
00169         }
00170         if(level == 1)
00171                         return  GetEntries(0,pin_locations_high_0[led],1,18);
00172 }
00173 
00174 if(box ==1){
00175         if(level == 0){
00176                         return  GetEntries(1,pin_locations_low_1[led],0,18);
00177         }
00178         if(level == 1)
00179                         return  GetEntries(1,pin_locations_high_1[led],1,18);
00180 }
00181 
00182 if(box ==2){
00183         if(level == 0){
00184                         return  GetEntries(0,pin_locations_low_2[led],0,18);
00185         }
00186         if(level == 1)
00187                         return  GetEntries(0,pin_locations_high_2[led],1,18);
00188 }
00189 
00190 if(box ==3){
00191         if(level == 0){
00192                         return  GetEntries(1,pin_locations_low_3[led],0,18);
00193         }
00194         if(level == 1)
00195                         return  GetEntries(1,pin_locations_high_3[led],1,18);
00196 }
00197 return 0;
00198 }
00199 
00200 Int_t Detector::GetStrip(Int_t side, Int_t plane,Int_t chip, Int_t channel, Int_t led){
00201         if(sides[side]!=0)
00202                 return sides[side]->GetStrip(plane,chip,channel,led);
00203         return -1;
00204 
00205 };
00206 Int_t Detector::GetPixelEntries(Int_t in_side,Int_t in_plane,Int_t in_pmt, Int_t in_pixel){
00207   return GetEntries(in_side,in_plane,GetChip(in_pmt),GetChannel(in_pixel));
00208 };
00209 Double_t Detector::GetPixelMean(Int_t in_side,Int_t in_plane,Int_t in_pmt, Int_t in_pixel){
00210   return GetMean(in_side,in_plane,GetChip(in_pmt),GetChannel(in_pixel));
00211 
00212 };
00213 Double_t Detector::GetPixelRMS(Int_t in_side, Int_t in_plane,Int_t in_pmt, Int_t in_pixel){
00214   return GetRMS(in_side,in_plane,GetChip(in_pmt),GetChannel(in_pixel));
00215 };
00216 
00217 Int_t Detector::GetChannel(Int_t pixel){
00218   int channelmap[] ={3,5,14,16,7,9,10,12,11,13,6,8,17,15,2,4};
00219   
00220   return channelmap[pixel];
00221 };
00222 
00223 Int_t Detector::GetChip(Int_t pmt){
00224   if(pmt == 0)
00225     return 0;
00226   if(pmt == 1)
00227     return 2;
00228   if(pmt == 2)
00229     return 1;
00230 };
00231 
00232 
00233 

Generated on Mon Feb 15 11:06:37 2010 for loon by  doxygen 1.3.9.1