SimPmtM64ToyNL Class Reference

#include <SimPmtM64ToyNL.h>

Inheritance diagram for SimPmtM64ToyNL:
SimPmtM64Full SimPmtM64 SimPmt

List of all members.

Public Member Functions

 SimPmtM64ToyNL (PlexPixelSpotId tube, VldContext context, TRandom *random=NULL)

Protected Member Functions

virtual void SimulateNonlinearity ()
virtual Float_t GenNonlinearCharge (Int_t pixel, Float_t inCharge)
virtual Float_t GenNonlinearRatio (Int_t pixel, Float_t inCharge)

Static Private Attributes

static Float_t fsNlSlope = 4.32e-4
static Float_t fsNlTurnOn = 15.8
static Float_t fsNlSaturate = 500

Detailed Description

Definition at line 15 of file SimPmtM64ToyNL.h.


Constructor & Destructor Documentation

SimPmtM64ToyNL::SimPmtM64ToyNL ( PlexPixelSpotId  tube,
VldContext  context,
TRandom *  random = NULL 
)

Definition at line 28 of file SimPmtM64ToyNL.cxx.

References Msg::kFatal, and MSG.

00030                                                   : 
00031   SimPmtM64Full(tube,context,random)
00032 {
00033   if (fNPixels > 64) {
00034     // If you want to do exotic things like making M64s with more than 64 
00035     // pixels then sorry, but you're on your own.
00036     MSG("Detsim",Msg::kFatal) 
00037       << "M64 requested with " << fNPixels << "pixels. What?" << endl;
00038     assert(0);  
00039     }
00040 }


Member Function Documentation

Float_t SimPmtM64ToyNL::GenNonlinearCharge ( Int_t  pixel,
Float_t  inCharge 
) [protected, virtual]

Reimplemented from SimPmtM64.

Definition at line 94 of file SimPmtM64ToyNL.cxx.

References GenNonlinearRatio().

00096 { 
00097   // Override of method in SimPmt. Using it is dangerous---does 
00098   // linCharge mean the charge in the bucket or the total
00099   // charge on the pixel? More useful is GenNonlinearRatio.
00100  
00101   return linCharge * GenNonlinearRatio(pixel, linCharge);
00102 }

Float_t SimPmtM64ToyNL::GenNonlinearRatio ( Int_t  pixel,
Float_t  inCharge 
) [protected, virtual]

Definition at line 105 of file SimPmtM64ToyNL.cxx.

References MuELoss::a, Munits::e_SI, F, fsNlSaturate, fsNlSlope, and fsNlTurnOn.

Referenced by GenNonlinearCharge(), and SimulateNonlinearity().

00107 {
00108   Float_t q_in_pe = linCharge / (0.8 * 1e6 * Munits::e_SI); 
00109   
00110  //Parametrisation NL of ND readout system with GC-LI
00111 
00112   //New parameterisation
00113   // - no nonlinearity below fsNlTurnOn
00114   // - saturating (1/Q) above fsNlSaturate
00115   // - linear in the intevening range
00116 
00117   if ( q_in_pe > fsNlTurnOn ){
00118     if (q_in_pe <= fsNlSaturate){
00119       // use form y = 1-m(x-t)
00120       return 1 - fsNlSlope * (q_in_pe - fsNlTurnOn);
00121     
00122     } 
00123     else {
00124       // use form y = a/(q-b) 
00125       // matching f & df/dq at the boundary [Upper case]
00126       // gives 
00127       //   a = F^2 / m   and   b = Q - F/m
00128       Float_t F = 1 - fsNlSlope * (fsNlSaturate - fsNlTurnOn);
00129       Float_t a = F*F / fsNlSlope;
00130       Float_t b = fsNlSaturate - F / fsNlSlope;
00131       return a / (q_in_pe - b);
00132       
00133     } // else (above saturation)
00134   } //if(above turnOn)
00135   
00136   return 1;
00137 
00138   
00139   //---Old parameteriastion--- 
00140   //  ~15% wrong
00141   //  unnessecary use of 5th order polynomial
00142 
00143   //   const double pol1[6]={  0,  //go to zero nonlinearity at zero pe      
00144   //                      3.71E-4,
00145   //                      -1.86E-5,
00146   //                      1.69E-7,
00147   //                      -6.54E-10,
00148   //                      9.06E-13 };
00149   //
00150   //
00151   //   const double pol2[2]={  0.011,
00152   //                      -4.65e-4};
00153   //
00154   //   Float_t fracLost = 0;
00155   //
00156   //      if(q_in_pe>=500) {
00157   //        //Flatten at some high value so charge dosen't go -ive
00158   //   fracLost =  pol2[0] 
00159   //       + pol2[1] * 500. ;
00160   //      }
00161   //      else if(q_in_pe>100 && q_in_pe < 500){
00162   //        fracLost = pol2[0] 
00163   //            + pol2[1] * q_in_pe;
00164   //      }
00165   //      else if(q_in_pe < 100){
00166   //        fracLost = pol1[0] 
00167   //            + pol1[1] * q_in_pe
00168   //            + pol1[2] * TMath::Power(q_in_pe,2)
00169   //            + pol1[3] * TMath::Power(q_in_pe,3)
00170   //            + pol1[4] * TMath::Power(q_in_pe,4)
00171   //            + pol1[5] * TMath::Power(q_in_pe,5);
00172   //      }
00173   //
00174   //     return (1 + fracLost);
00175   // ---======----
00176 
00177 
00178 }

void SimPmtM64ToyNL::SimulateNonlinearity (  )  [protected, virtual]

Reimplemented from SimPmt.

Definition at line 44 of file SimPmtM64ToyNL.cxx.

References SimPmt::fNPixels, GenNonlinearRatio(), SimPixelTimeBucket::GetCharge(), SimPmtTimeBucket::GetPixelBucket(), it, and SimPixelTimeBucket::SetCharge().

00045 {
00046   Float_t totalQ[65];  //nasty, hardcoded value of fNPixels+1.
00047   
00048   for (UInt_t pix = 1 ; pix <= 64 ; ++pix ) totalQ[pix] = 0.0;
00049 
00050   //iterate over time buckets
00051   for (SimPmtBucketIterator it(*this); !it.End(); it.Next()) {
00052     SimPmtTimeBucket& bucket = it.Bucket();
00053 
00054   //iterate over pixels
00055     for (Int_t pix =1; pix <= fNPixels; pix++) {
00056       SimPixelTimeBucket& pixelBucket = bucket.GetPixelBucket(pix);
00057       
00058       //add charge in this pixelBucket to the charge on the pixel
00059       totalQ[pix] += pixelBucket.GetCharge();
00060       
00061     } //pixels
00062   } //buckets
00063   
00064   // calculate nonlinearity factor for each pixel, based on 
00065   // the summed charge (do it outside the bucket loop)
00066   
00067   //cout << totalQ[22] / (0.8 *1e6 *Munits::e_SI) << endl;
00068  Float_t ratioNL[65];
00069  for (Int_t pix = 1 ; pix <= fNPixels ; ++pix ) {
00070    ratioNL[pix] = GenNonlinearRatio(pix, totalQ[pix]);
00071   }
00072   
00073   //iterate over timebuckets > pixels again
00074   for (SimPmtBucketIterator it(*this); !it.End(); it.Next()) {
00075     SimPmtTimeBucket& bucket = it.Bucket();
00076 
00077     for (Int_t pix =1; pix <= fNPixels; pix++) {
00078       SimPixelTimeBucket& pixelBucket = bucket.GetPixelBucket(pix);
00079 
00080       // Reduce the charge inthis pixelBucket by the corresponding
00081       // nonlinearity ratio
00082       pixelBucket.SetCharge( ratioNL[pix] * pixelBucket.GetCharge() );
00083       
00084     } //pixels
00085   } //buckets
00086   
00087   return;
00088 }


Member Data Documentation

Float_t SimPmtM64ToyNL::fsNlSaturate = 500 [static, private]

Definition at line 32 of file SimPmtM64ToyNL.h.

Referenced by GenNonlinearRatio().

Float_t SimPmtM64ToyNL::fsNlSlope = 4.32e-4 [static, private]

Definition at line 30 of file SimPmtM64ToyNL.h.

Referenced by GenNonlinearRatio().

Float_t SimPmtM64ToyNL::fsNlTurnOn = 15.8 [static, private]

Definition at line 31 of file SimPmtM64ToyNL.h.

Referenced by GenNonlinearRatio().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1