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

PhotonNdAfterpulseModel.cxx

Go to the documentation of this file.
00001 #include "PhotonNdAfterpulseModel.h"
00002 #include "PhotonTransportMaker.h"
00003 #include "ScintPhoton.h"
00004 #include "MessageService/MsgService.h"
00005 #include "Plex/PlexHandle.h"
00006 #include "Digitization/DigiSignal.h"
00007 
00008 CVSID( " $Id: PhotonNdAfterpulseModel.cxx,v 1.3 2006/12/01 20:12:11 rhatcher Exp $" );
00009 
00010 ClassImp(PhotonNdAfterpulseModel)
00011 
00012 PhotonTransportMakerProxy<PhotonNdAfterpulseModel>
00013         gPhotonNdAfterpulseProxy("photonNdAfterpulseModel"); 
00014 
00015 
00017 // Constructor
00018 PhotonNdAfterpulseModel::PhotonNdAfterpulseModel() 
00019 {
00020   Configure(PhotonConfiguration()); // Set up default values.
00021 }
00022 
00024 // Reset
00025 void 
00026 PhotonNdAfterpulseModel::Reset( const VldContext& /* cx */)
00027 {
00028   // Called once per event. Use this to get or update
00029   // any database tables used by the model.
00030 }
00031 
00032 
00034 // Configure the model.
00035 void 
00036 PhotonNdAfterpulseModel::Configure( const Registry& r )
00037 {
00038   // The other classses in the model need configuring:
00039   ScintPhoton::Configure(r);
00040 
00041   MSG("Photon",Msg::kDebug) << "Configuring NdAfterpulseModel." << std::endl;
00042   
00043   // Load any configuration options from the provided registry.
00044   // Called only when configuration changes.
00045   // Put default values into the file PhotonConfiguration.cxx
00046 
00047   fAfterpulseFraction = r.GetDouble("AfterpulseFraction");
00048   fAfterpulseStart    = r.GetDouble("AfterpulseStart");
00049   fAfterpulseEnd      = r.GetDouble("AfterpulseEnd");
00050 }
00051 
00052 
00053 void PhotonNdAfterpulseModel::MakeAfterpulses( const std::vector<DigiPE*>& inPeList,
00054                                                std::vector<DigiPE*>& outPeList )
00055 {
00060 
00061   // Simple model: generate a pe at random on the same tube,
00062   // randomly on pixels 1-8 or 57-64, between 1 and 4us after the
00063   // intial pulse, 4% of the time.
00064 
00065   for(UInt_t i=0;i<inPeList.size(); i++) {
00066     const DigiPE* inPE = inPeList[i];
00067     PlexPixelSpotId inPix = inPE->GetPixelSpotId();
00068     if(inPix.GetElecType()==ElecType::kQIE) {
00069       // This is an M64.
00070       
00071       // Roll to see if an afterpulse is made:
00072       if(fRandom->Rndm() < fAfterpulseFraction) {
00073         
00074         // Make the new one.
00075 
00076         // Chose the pixel:
00077         int pixel = fRandom->Integer(8)+1; // 1-8
00078         if(fRandom->Rndm()>0.5) pixel+= 56; // 57-64
00079 
00080         // Set the PixelSpotId:
00081         PlexPixelSpotId outPix = inPix;
00082         outPix.SetSpot(1);
00083         outPix.SetPixel(pixel);
00084 
00085         // Chose the time of the PE:
00086         double time = inPE->GetTime();
00087         time += fRandom->Uniform(fAfterpulseStart,fAfterpulseEnd);
00088         
00089         // Create it and put it into the output list.
00090         DigiPE* outPE = new DigiPE(time, outPix, DigiSignal::kAfterpulse );
00091         outPeList.push_back(outPE);
00092       }
00093 
00094     }
00095   }
00096 
00097   return;
00098 }
00099 
00100 
00101 
00102 
00103 void PhotonNdAfterpulseModel::Print(Option_t* /* option */) const
00104 {
00106 }
00107 

Generated on Mon Feb 15 11:07:22 2010 for loon by  doxygen 1.3.9.1