LIPmt Class Reference

#include <LIPmt.h>

List of all members.

Public Member Functions

 LIPmt ()
 LIPmt (Int_t numPixels, Int_t numPixelSpots)
 ~LIPmt ()
void AddMultiPoint (Int_t pixel, Int_t pixelSpot, Double_t gain)
void Initialise (Int_t numPixels, Int_t numPixelSpots)
void SetPoint (Int_t pixel, Int_t pixelSpot, Double_t gain)
void FillGainsHisto (TH1F *hGainAvDet) const
Double_t GetAvPmtGain () const
const std::vector< Double_t > & GetGains () const
Double_t GetGain (Int_t pixel, Int_t pixelSpot=-1) const
std::vector< Int_t > GetNearestNeighbours (Int_t pixel) const
Double_t GetNearestNeighboursAvGain (Int_t pixel) const
Int_t GetNearestNeighboursNum (Int_t pixel) const
Double_t GetPixelGain (Int_t pixel) const
Int_t GetPixelNum (Int_t pixel) const
Int_t GetPmtNum () const
TH2F * GetPmtFaceMap (string sTitle="hPmtFaceMap") const
Bool_t IsEmpty () const
void Print (Option_t *option="") const
void PrintNearestNeighbours () const

Private Member Functions

void InitialiseVariables (Int_t numPixels, Int_t numPixelSpots)
 ClassDef (LIPmt, 0)

Private Attributes

std::vector< Int_t > fCounter
std::vector< Double_t > fGains
Double_t fGainsSum
Int_t fGainsNum
Bool_t fInitialised
LILookup lookup
Int_t fNumPixels
Int_t fNumPixelSpots
std::vector< Double_t > fPixelGainsSum
std::vector< Int_t > fPixelGainsNum
std::string fS

Detailed Description

Definition at line 28 of file LIPmt.h.


Constructor & Destructor Documentation

LIPmt::LIPmt (  ) 

Definition at line 26 of file LIPmt.cxx.

References Msg::kDebug, and MSG.

00027 {
00028   MSG("LIPmt", Msg::kDebug) 
00029     <<"Running LIPmt default constructor..."<<endl;
00030   
00031   fInitialised=false;
00032 
00033   MSG("LIPmt", Msg::kDebug) 
00034     <<"Finished LIPmt default constructor"<<endl;
00035 }

LIPmt::LIPmt ( Int_t  numPixels,
Int_t  numPixelSpots 
)

Definition at line 39 of file LIPmt.cxx.

References fInitialised, InitialiseVariables(), Msg::kDebug, and MSG.

00040 {
00041   MSG("LIPmt", Msg::kDebug) 
00042     <<"Running LIPmt constructor..."<<endl;
00043   
00044   this->InitialiseVariables(numPixels,numPixelSpots);  
00045   fInitialised=true;
00046 
00047   MSG("LIPmt", Msg::kDebug) 
00048     <<"Finished LIPmt constructor"<<endl;
00049 }

LIPmt::~LIPmt (  ) 

Definition at line 53 of file LIPmt.cxx.

References Msg::kDebug, and MSG.

00054 {
00055   MSG("LIPmt", Msg::kDebug) 
00056     <<"Running LIPmt destructor..."<<endl;
00057   
00058   
00059   MSG("LIPmt", Msg::kDebug) 
00060     <<"Finished LIPmt destructor"<<endl;
00061 }


Member Function Documentation

void LIPmt::AddMultiPoint ( Int_t  pixel,
Int_t  pixelSpot,
Double_t  gain 
)

This method is meant for when you want to add multiple gains to a single pixel/pixelSpot, say if you want to calculate the average

Definition at line 260 of file LIPmt.cxx.

References fCounter, fGains, fGainsNum, fGainsSum, fNumPixels, fNumPixelSpots, fPixelGainsNum, fPixelGainsSum, Msg::kDebug, Msg::kVerbose, Msg::kWarning, and MSG.

Referenced by LIPlexMaps::ReadDbGains().

00261 {
00265 
00266   MSG("LIPmt",Msg::kVerbose)<<"Running AddMultiPoint method..."<<endl;
00267 
00268   //make pixelSpot start at zero
00269   pixelSpot--;
00270 
00271   MSG("LIPmt",Msg::kDebug)
00272     <<"("<<pixel<<","<<pixelSpot<<")"
00273     <<" Adding new point: gain="<<gain<<endl;
00274 
00275   if (pixel>=0 && pixel<fNumPixels){
00276     if (pixelSpot>=0 && pixelSpot<fNumPixelSpots){
00277 
00278       Int_t spotIndex=pixel*fNumPixelSpots+pixelSpot;
00279       
00280       //work out the running total
00281       fGainsSum+=gain;
00282       fGainsNum++;
00283 
00284       //sum the individual gain
00285       fGains[spotIndex]+=gain;
00286       fCounter[spotIndex]++;
00287 
00288       //calculate and store the running total of gains on a pixel
00289       if (fNumPixelSpots>1){
00290         fPixelGainsSum[pixel]+=gain;
00291         fPixelGainsNum[pixel]++;
00292       }
00293 
00294     }
00295     else{
00296       MSG("LIPmt",Msg::kWarning)
00297         <<"Pixel Spot is wrong, pixel="<<pixel
00298         <<", pixelSpot="<<pixelSpot<<", gain="<<gain<<endl;
00299     }
00300   }
00301   else{
00302     MSG("LIPmt",Msg::kWarning)
00303       <<"Pixel is wrong, pixel="<<pixel
00304       <<", pixelSpot="<<pixelSpot<<", gain="<<gain<<endl;
00305   }
00306   
00307   MSG("LIPmt",Msg::kVerbose)<<"AddMultiPoint method finished"<<endl;
00308 }

LIPmt::ClassDef ( LIPmt  ,
 
) [private]
void LIPmt::FillGainsHisto ( TH1F *  hGainAvDet  )  const

Definition at line 636 of file LIPmt.cxx.

References fCounter, fGains, Msg::kDebug, and MSG.

00637 {
00638   MSG("LIPmt",Msg::kDebug)<<"Running FillHisto method..."<<endl;
00639 
00640   //check histo and gains vector exists
00641   if (hGainAvDet && fGains.size()>0){
00642 
00643     vector<Double_t>::const_iterator gain=fGains.begin();
00644     vector<Int_t>::const_iterator counter=fCounter.begin();
00645 
00646     while(gain!=fGains.end()){
00647       //protect against fpe
00648       if (*counter>0){
00649         //fill histo
00650         hGainAvDet->Fill(*gain/(*counter));
00651       }
00652       gain++;
00653       counter++;
00654     }
00655   }
00656   
00657   MSG("LIPmt",Msg::kDebug)<<"Finished FillHisto method"<<endl;
00658 }

Double_t LIPmt::GetAvPmtGain (  )  const

Definition at line 344 of file LIPmt.cxx.

References fGainsNum, fGainsSum, Msg::kVerbose, and MSG.

00345 {
00346   MSG("LIPmt",Msg::kVerbose) 
00347     <<"Running GetAvPmtGain method..."<<endl;
00348 
00349   Double_t avGain=-1;
00350   if (fGainsNum>0) avGain=fGainsSum/fGainsNum;
00351 
00352   MSG("LIPmt",Msg::kVerbose) 
00353     <<"GetAvPmtGain method finished"<<endl;
00354   return avGain;
00355 }

Double_t LIPmt::GetGain ( Int_t  pixel,
Int_t  pixelSpot = -1 
) const

Definition at line 312 of file LIPmt.cxx.

References fCounter, fGains, fNumPixels, and fNumPixelSpots.

00313 {
00314   //make pixelSpot start at zero
00315   pixelSpot--;
00316 
00317   if (pixel>=0 && pixel<fNumPixels){
00318     if (pixelSpot>=0 && pixelSpot<fNumPixelSpots){
00319       Int_t spotIndex=pixel*fNumPixelSpots+pixelSpot;
00320 
00321       //protect against fpe
00322       if (fCounter[spotIndex]>0){
00323         return fGains[spotIndex]/fCounter[spotIndex];
00324       }
00325     }
00326   }
00327   return -1;
00328 } 

const vector< Double_t > & LIPmt::GetGains (  )  const

Definition at line 332 of file LIPmt.cxx.

References fGains, Msg::kVerbose, and MSG.

Referenced by operator<(), and operator==().

00333 {
00334   MSG("LIPmt",Msg::kVerbose) 
00335     <<"Running GetGain method..."<<endl;
00336 
00337   MSG("LIPmt",Msg::kVerbose) 
00338     <<"GetGain method finished"<<endl;
00339   return fGains;
00340 }

vector< Int_t > LIPmt::GetNearestNeighbours ( Int_t  pixel  )  const

Definition at line 420 of file LIPmt.cxx.

References fNumPixels, fNumPixelSpots, Msg::kVerbose, Msg::kWarning, and MSG.

Referenced by GetNearestNeighboursAvGain(), GetNearestNeighboursNum(), and PrintNearestNeighbours().

00421 {
00422   MSG("LIPmt",Msg::kVerbose)
00423     <<"Running GetNearestNeighbours method..."<<endl;
00424 
00425   vector<Int_t> nearestNeighbours;
00426 
00427   //check that you know the pmt type
00428   if (fNumPixels<=0){
00429     MSG("LIPmt",Msg::kWarning)
00430       <<"Num of pixels <=0, fNumPixels="<<fNumPixels
00431       <<", fNumPixelSpots="<<fNumPixelSpots<<endl
00432       <<"The object must be initialised, returning empty vector"<<endl;
00433     return nearestNeighbours;
00434   }
00435 
00436   if (pixel>=0 && pixel<fNumPixels){
00437     
00438     Int_t pmtWidth=static_cast
00439       <Int_t>(sqrt(static_cast<Float_t>(fNumPixels)));
00440 
00441     //first do the corners
00442     if (pixel==0 || pixel==pmtWidth-1 || 
00443         pixel==fNumPixels-pmtWidth || pixel==fNumPixels-1){
00444       //calculate each of the 4 corners separately
00445       if (pixel==0){
00446         nearestNeighbours.push_back(pixel+1);
00447         nearestNeighbours.push_back(pixel+pmtWidth);
00448       }
00449       else if (pixel==pmtWidth-1){
00450         nearestNeighbours.push_back(pixel-1);
00451         nearestNeighbours.push_back(pixel+pmtWidth);
00452       }
00453       else if (pixel==fNumPixels-pmtWidth){
00454         nearestNeighbours.push_back(pixel-pmtWidth);
00455         nearestNeighbours.push_back(pixel+1);
00456       }
00457       else if (pixel==fNumPixels-1){
00458         nearestNeighbours.push_back(pixel-pmtWidth);
00459         nearestNeighbours.push_back(pixel-1);
00460       }
00461     }
00462     //find the edges (corners are already found though)
00463     else if (pixel<pmtWidth || pixel>=fNumPixels-pmtWidth ||
00464              pixel%pmtWidth==0 || pixel%pmtWidth==pmtWidth-1){
00465       //bottom edge
00466       if (pixel<pmtWidth){
00467         nearestNeighbours.push_back(pixel-1);
00468         nearestNeighbours.push_back(pixel+1);
00469         nearestNeighbours.push_back(pixel+pmtWidth);
00470       }
00471       //left edge
00472       else if (pixel%pmtWidth==0){
00473         nearestNeighbours.push_back(pixel-pmtWidth);
00474         nearestNeighbours.push_back(pixel+1);
00475         nearestNeighbours.push_back(pixel+pmtWidth);
00476       }
00477       else if (pixel%pmtWidth==pmtWidth-1){
00478         nearestNeighbours.push_back(pixel-pmtWidth);
00479         nearestNeighbours.push_back(pixel-1);
00480         nearestNeighbours.push_back(pixel+pmtWidth);
00481       }
00482       else if (pixel>=fNumPixels-pmtWidth){
00483         nearestNeighbours.push_back(pixel-pmtWidth);
00484         nearestNeighbours.push_back(pixel-1);
00485         nearestNeighbours.push_back(pixel+1);
00486       }
00487     }
00488     //in the middle somewhere
00489     else {
00490       nearestNeighbours.push_back(pixel-pmtWidth);
00491       nearestNeighbours.push_back(pixel-1);
00492       nearestNeighbours.push_back(pixel+1);
00493       nearestNeighbours.push_back(pixel+pmtWidth);
00494     }
00495   }
00496   else {
00497     MSG("LIPmt",Msg::kWarning)<<"Pixel is wrong, pixel="<<pixel<<endl;
00498   }
00499 
00500   MSG("LIPmt",Msg::kVerbose) 
00501     <<"Finished GetNearestNeighbours method"<<endl;
00502   return nearestNeighbours;
00503 }

Double_t LIPmt::GetNearestNeighboursAvGain ( Int_t  pixel  )  const

Definition at line 507 of file LIPmt.cxx.

References fCounter, fGains, fNumPixels, fNumPixelSpots, fPixelGainsNum, fPixelGainsSum, GetNearestNeighbours(), Msg::kVerbose, Msg::kWarning, and MSG.

00508 {
00509   MSG("LIPmt",Msg::kVerbose) 
00510     <<"Running GetNearestNeighboursAvGain method..."<<endl;
00511 
00512   Double_t pixelGain=0;
00513   Int_t counter=0;
00514   
00515   if (pixel>=0 && pixel<fNumPixels){
00516 
00517     vector<Int_t> nearestNeighbours=this->GetNearestNeighbours(pixel);
00518     vector<Int_t>::iterator nnPixel=nearestNeighbours.begin();
00519     
00520     //loop over the nearestNeighbour (nn) pixels
00521     while (nnPixel!=nearestNeighbours.end()){
00522 
00523       //calculate the running total of gains on a pixel spot
00524       if (fNumPixelSpots>1){
00525         //protect against fpe
00526         if (fPixelGainsNum[*nnPixel]>0){
00527           pixelGain+=fPixelGainsSum[*nnPixel]/fPixelGainsNum[*nnPixel];
00528           counter++;
00529         }
00530       }
00531       //only one spot per pixel , e.g. M64
00532       else {
00533         //there is no average of spots so only the gain of that pixel
00534         if (fCounter[*nnPixel]>0){
00535           pixelGain+=fGains[*nnPixel]/fCounter[*nnPixel];
00536           counter++;
00537         }
00538       }
00539       nnPixel++;
00540     }
00541 
00542     //calc average
00543     if (counter>0) pixelGain/=counter;
00544     else pixelGain=-1;
00545   }
00546   else {
00547     pixelGain=-1;
00548     MSG("LIPmt",Msg::kWarning)<<"Pixel is wrong, pixel="<<pixel<<endl;
00549   }
00550 
00551   MSG("LIPmt",Msg::kVerbose) 
00552     <<"Finished GetNearestNeighboursAvGain method"<<endl;
00553   return pixelGain;
00554 }

Int_t LIPmt::GetNearestNeighboursNum ( Int_t  pixel  )  const

Definition at line 558 of file LIPmt.cxx.

References fCounter, fNumPixels, fNumPixelSpots, fPixelGainsNum, GetNearestNeighbours(), Msg::kVerbose, Msg::kWarning, and MSG.

00559 {
00560   MSG("LIPmt",Msg::kVerbose) 
00561     <<"Running GetNearestNeighboursNum method..."<<endl;
00562 
00563   Int_t totalNum=0;
00564   Int_t counter=0;
00565 
00566   if (pixel>=0 && pixel<fNumPixels){
00567 
00568     vector<Int_t> nearestNeighbours=this->GetNearestNeighbours(pixel);
00569     vector<Int_t>::iterator nnPixel=nearestNeighbours.begin();
00570     
00571     //loop over the nearestNeighbour (nn) pixels
00572     while (nnPixel!=nearestNeighbours.end()){
00573 
00574       //calculate the running total of gains on a pixel spot
00575       if (fNumPixelSpots>1){
00576         //protect against fpe
00577         if (fPixelGainsNum[*nnPixel]>0){
00578           totalNum+=fPixelGainsNum[*nnPixel];
00579           counter++;
00580         }
00581       }
00582       //only one spot per pixel , e.g. M64
00583       else {
00584         //there is no average of spots so only use pixel indexed vector
00585         if (fCounter[*nnPixel]>0){
00586           totalNum+=fCounter[*nnPixel];
00587           counter++;
00588         }
00589       }
00590       nnPixel++;
00591     }
00592 
00593     //calc average
00594     if (counter<=0) totalNum=-1;
00595   }
00596   else {
00597     totalNum=-1;
00598     MSG("LIPmt",Msg::kWarning)<<"Pixel is wrong, pixel="<<pixel<<endl;
00599   }
00600 
00601   MSG("LIPmt",Msg::kVerbose) 
00602     <<"Finished GetNearestNeighboursNum method"<<endl;
00603   return totalNum;
00604 }

Double_t LIPmt::GetPixelGain ( Int_t  pixel  )  const

Definition at line 359 of file LIPmt.cxx.

References fCounter, fGains, fNumPixels, fNumPixelSpots, fPixelGainsNum, fPixelGainsSum, Msg::kVerbose, Msg::kWarning, and MSG.

Referenced by GetPmtFaceMap(), Print(), and LIPlexMaps::ReadDbGains().

00360 {
00361   MSG("LIPmt",Msg::kVerbose) 
00362     <<"Running GetPixelGain method..."<<endl;
00363 
00364   Double_t pixelGain=-1;
00365   
00366   if (pixel>=0 && pixel<fNumPixels){
00367     
00368     //calculate the running total of gains on a pixel spot
00369     if (fNumPixelSpots>1){
00370       //protect against fpe
00371       if (fPixelGainsNum[pixel]>0){
00372         pixelGain=fPixelGainsSum[pixel]/fPixelGainsNum[pixel];
00373       }
00374     }
00375     else {//only one spot per pixel , e.g. M64
00376       //there is no average gain and only the gain of that pixel
00377       if (fCounter[pixel]>0) pixelGain=fGains[pixel]/fCounter[pixel];
00378     }
00379   }
00380   else {
00381     MSG("LIPmt",Msg::kWarning)<<"Pixel is wrong, pixel="<<pixel<<endl;
00382   }
00383 
00384   MSG("LIPmt",Msg::kVerbose) 
00385     <<"GetPixelGain method finished"<<endl;
00386   return pixelGain;
00387 }

Int_t LIPmt::GetPixelNum ( Int_t  pixel  )  const

Definition at line 391 of file LIPmt.cxx.

References fCounter, fNumPixels, fNumPixelSpots, fPixelGainsNum, Msg::kVerbose, Msg::kWarning, and MSG.

00392 {
00393   MSG("LIPmt",Msg::kVerbose) 
00394     <<"Running GetPixelNum method..."<<endl;
00395 
00396   Int_t pixelNum=0;
00397 
00398   if (pixel>=0 && pixel<fNumPixels){
00399     
00400     //calculate the running total of gains on a pixel spot
00401     if (fNumPixelSpots>1){
00402       pixelNum=fPixelGainsNum[pixel];
00403     }
00404     else {//only one spot per pixel
00405       //there is no average gain and only the gain of that pixel
00406       pixelNum=fCounter[pixel];
00407     }
00408   }
00409   else {
00410     MSG("LIPmt",Msg::kWarning)<<"Pixel is wrong, pixel="<<pixel<<endl;
00411   }
00412 
00413   MSG("LIPmt",Msg::kVerbose) 
00414     <<"GetPixelNum method finished"<<endl;
00415   return pixelNum;
00416 }

TH2F * LIPmt::GetPmtFaceMap ( string  sTitle = "hPmtFaceMap"  )  const

Definition at line 168 of file LIPmt.cxx.

References fInitialised, fNumPixels, fNumPixelSpots, GetPixelGain(), Msg::kWarning, and MSG.

Referenced by LIPlexMaps::ReadDbGains().

00169 {
00170   if (!fInitialised) return 0;
00171 
00172   //check that you know the pmt type
00173   if (fNumPixels<=0){
00174     MSG("LIPmt",Msg::kWarning)
00175       <<"Num of pixels <=0, fNumPixels="<<fNumPixels
00176       <<", fNumPixelSpots="<<fNumPixelSpots<<endl
00177       <<"The object must be initialised"<<endl;
00178     return 0;
00179   }
00180 
00181   Int_t pmtWidth=static_cast<Int_t>
00182     (sqrt(static_cast<Float_t>(fNumPixels)));
00183 
00184   TH2F* hPmtFace=new TH2F(sTitle.c_str(),sTitle.c_str(),
00185                           pmtWidth+2,-1,pmtWidth+1,
00186                           pmtWidth+2,-1,pmtWidth+1);
00187   hPmtFace->SetTitle(sTitle.c_str());
00188   hPmtFace->SetFillColor(2);  
00189   //hPmtFace->SetBit(TH1::kCanRebin);
00190 
00191   for(int row=0;row<pmtWidth;row++){
00192     for(int p=0;p<pmtWidth;p++){
00193 
00194       hPmtFace->Fill(p,row,this->GetPixelGain(row*pmtWidth+p));
00195 
00196     }
00197   }
00198   
00199   return hPmtFace;
00200 }

Int_t LIPmt::GetPmtNum (  )  const [inline]

Definition at line 52 of file LIPmt.h.

References fGainsNum.

00052 {return fGainsNum;}

void LIPmt::Initialise ( Int_t  numPixels,
Int_t  numPixelSpots 
)

Definition at line 79 of file LIPmt.cxx.

References fInitialised, InitialiseVariables(), Msg::kVerbose, and MSG.

Referenced by LIPlexMaps::ReadDbGains().

00080 {
00081   MSG("LIPmt",Msg::kVerbose) 
00082     <<"Running Initialise method..."<<endl;
00083 
00084   if (!fInitialised){
00085     this->InitialiseVariables(numPixels,numPixelSpots);
00086     fInitialised=true;
00087   }
00088 
00089   MSG("LIPmt",Msg::kVerbose) 
00090     <<"Initialise method finished"<<endl;
00091 }

void LIPmt::InitialiseVariables ( Int_t  numPixels,
Int_t  numPixelSpots 
) [private]

Definition at line 95 of file LIPmt.cxx.

References fCounter, fGains, fGainsNum, fGainsSum, fInitialised, fNumPixels, fNumPixelSpots, fPixelGainsNum, fPixelGainsSum, fS, Msg::kDebug, Msg::kVerbose, and MSG.

Referenced by Initialise(), and LIPmt().

00096 {
00097   MSG("LIPmt",Msg::kVerbose) 
00098     <<"Running InitialiseVariables method..."<<endl;
00099 
00100   MSG("LIPmt",Msg::kDebug)
00101     <<"Initialised variables, fInitialised="<<fInitialised
00102     <<", numPixels="<<numPixels<<", numPixelSpots="<<numPixelSpots 
00103     <<endl;
00104 
00105   fNumPixels=numPixels;
00106   fNumPixelSpots=numPixelSpots;
00107   fGainsSum=0;
00108   fGainsNum=0;
00109   fS="";
00110 
00111   //initialise all the vectors
00112   for (Int_t spot=0;spot<fNumPixels*fNumPixelSpots;spot++){
00113     fGains.push_back(0);
00114     fCounter.push_back(0);
00115   }
00116 
00117   if (numPixelSpots>1){
00118     //initialise the vector to hold the average gain for a pixel
00119     for (Int_t pix=0;pix<fNumPixels;pix++){
00120       fPixelGainsSum.push_back(0);
00121       fPixelGainsNum.push_back(0);
00122     }
00123   }
00124 
00125   MSG("LIPmt",Msg::kVerbose) 
00126     <<"InitialiseVariables method finished"<<endl;
00127 }

Bool_t LIPmt::IsEmpty (  )  const

Definition at line 131 of file LIPmt.cxx.

References fGainsNum.

Referenced by LIPlexMaps::ReadDbGains().

00132 {
00133   if (fGainsNum>0) return false;
00134   else return true;
00135 }

void LIPmt::Print ( Option_t *  option = ""  )  const

Definition at line 139 of file LIPmt.cxx.

References fInitialised, fNumPixels, fNumPixelSpots, GetPixelGain(), Msg::kInfo, Msg::kWarning, and MSG.

00140 {
00141   if (!fInitialised) return;
00142 
00143   //check that you know the pmt type
00144   if (fNumPixels<=0){
00145     MSG("LIPmt",Msg::kWarning)
00146       <<"Num of pixels <=0, fNumPixels="<<fNumPixels
00147       <<", fNumPixelSpots="<<fNumPixelSpots<<endl
00148       <<"The object must be initialised"<<endl;
00149     return;
00150   }
00151 
00152   Int_t pmtWidth=static_cast<Int_t>
00153     (sqrt(static_cast<Float_t>(fNumPixels)));
00154 
00155   for(int row=0;row<pmtWidth;row++){
00156     for(int p=0;p<pmtWidth;p++){
00157       
00158       MSG("LIPmt",Msg::kInfo)
00159         <<static_cast<Int_t>(this->GetPixelGain(row*pmtWidth+p))<<" ";
00160     }
00161     //leave a line between rows
00162     MSG("LIPmt",Msg::kInfo)<<endl;
00163   }
00164 }

void LIPmt::PrintNearestNeighbours (  )  const

Definition at line 608 of file LIPmt.cxx.

References fNumPixels, fNumPixelSpots, GetNearestNeighbours(), LILookup::GetVectorAsString(), Msg::kInfo, Msg::kWarning, lookup, and MSG.

00609 {
00610   MSG("LIPmt",Msg::kInfo)
00611     <<"Running PrintNearestNeighbours method..."<<endl;
00612 
00613   //check that you know the pmt type
00614   if (fNumPixels<=0){
00615     MSG("LIPmt",Msg::kWarning)
00616       <<"Num of pixels <=0, fNumPixels="<<fNumPixels
00617       <<", fNumPixelSpots="<<fNumPixelSpots<<endl
00618       <<"The object must be initialised"<<endl;
00619   }
00620 
00621   for (Int_t i=0;i<fNumPixels;i++){
00622     vector<Int_t> nearestNeighbours=this->GetNearestNeighbours(i);
00623     
00624     string sNn=lookup.GetVectorAsString(nearestNeighbours);
00625     
00626     MSG("LIPmt",Msg::kInfo) 
00627       <<"Pixel="<<i<<" has nearest neighbours: "<<sNn;
00628   }
00629 
00630   MSG("LIPmt",Msg::kInfo) 
00631     <<"Finished PrintNearestNeighbours method"<<endl;
00632 }

void LIPmt::SetPoint ( Int_t  pixel,
Int_t  pixelSpot,
Double_t  gain 
)

Definition at line 204 of file LIPmt.cxx.

References fCounter, fGains, fGainsNum, fGainsSum, fNumPixels, fNumPixelSpots, fPixelGainsNum, fPixelGainsSum, Msg::kDebug, Msg::kVerbose, Msg::kWarning, and MSG.

00205 {
00206   MSG("LIPmt",Msg::kVerbose)<<"Running SetPoint method..."<<endl;
00207 
00208   //make pixelSpot start at zero
00209   pixelSpot--;
00210 
00211   MSG("LIPmt",Msg::kDebug)
00212     <<"("<<pixel<<","<<pixelSpot<<")"
00213     <<" Setting point: gain="<<gain<<endl;
00214 
00215   if (pixel>=0 && pixel<fNumPixels){
00216     if (pixelSpot>=0 && pixelSpot<fNumPixelSpots){
00217 
00218       Int_t spotIndex=pixel*fNumPixelSpots+pixelSpot;
00219       
00220       //work out the running total
00221       fGainsSum+=gain;
00222       fGainsNum++;
00223 
00224       //store the individual gain
00225       fGains[spotIndex]=gain;
00226 
00227       //sanity check
00228       if (fCounter[spotIndex]!=0){
00229         MSG("LIPmt",Msg::kWarning) 
00230           <<"This pixel and pixelSpot have already been set!"<<endl
00231           <<"Pixel="<<pixel<<", pixelSpot="<<pixelSpot
00232           <<", counter="<<fCounter[spotIndex]<<endl;
00233       }
00234       fCounter[spotIndex]++;
00235 
00236       //calculate and store the running total of gains on a pixel spot
00237       if (fNumPixelSpots>1){
00238         fPixelGainsSum[pixel]+=gain;
00239         fPixelGainsNum[pixel]++;
00240       }
00241 
00242     }
00243     else{
00244       MSG("LIPmt",Msg::kWarning)
00245         <<"Pixel Spot is wrong, pixel="<<pixel
00246         <<", pixelSpot="<<pixelSpot<<", gain="<<gain<<endl;
00247     }
00248   }
00249   else{
00250     MSG("LIPmt",Msg::kWarning)
00251       <<"Pixel is wrong, pixel="<<pixel
00252       <<", pixelSpot="<<pixelSpot<<", gain="<<gain<<endl;
00253   }
00254   
00255   MSG("LIPmt",Msg::kVerbose)<<"SetPoint method finished"<<endl;
00256 }


Member Data Documentation

std::vector<Int_t> LIPmt::fCounter [private]
std::vector<Double_t> LIPmt::fGains [private]
Int_t LIPmt::fGainsNum [private]

Definition at line 70 of file LIPmt.h.

Referenced by AddMultiPoint(), GetAvPmtGain(), GetPmtNum(), InitialiseVariables(), IsEmpty(), and SetPoint().

Double_t LIPmt::fGainsSum [private]

Definition at line 69 of file LIPmt.h.

Referenced by AddMultiPoint(), GetAvPmtGain(), InitialiseVariables(), and SetPoint().

Bool_t LIPmt::fInitialised [private]

Definition at line 71 of file LIPmt.h.

Referenced by GetPmtFaceMap(), Initialise(), InitialiseVariables(), LIPmt(), and Print().

Int_t LIPmt::fNumPixels [private]
Int_t LIPmt::fNumPixelSpots [private]
std::vector<Int_t> LIPmt::fPixelGainsNum [private]
std::vector<Double_t> LIPmt::fPixelGainsSum [private]
std::string LIPmt::fS [private]

Definition at line 80 of file LIPmt.h.

Referenced by InitialiseVariables().

Definition at line 72 of file LIPmt.h.

Referenced by PrintNearestNeighbours().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1