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

rsim::ReadoutSim Class Reference

#include <ReadoutSim.h>

Inheritance diagram for rsim::ReadoutSim:

jobc::Module cfg::Observer List of all members.

Public Member Functions

 ReadoutSim (const char *version)
 ~ReadoutSim ()
void Update (const cfg::Config &c)
jobc::Result Reco (edm::EventHandle &evt)
void ChooseSim (std::string s)

Private Attributes

float pPEThreshold
double pSinglePulseTRes
double pDoublePulseTSep
double pClockTick
float pQuantumEff
float pPeToADC
int msglevel
int storemcinfo
SimulatormySim

Constructor & Destructor Documentation

ReadoutSim::ReadoutSim const char *  version  ) 
 

Definition at line 30 of file ReadoutSim.cxx.

References cfg::Observer::SetWatch().

00030                                           :
00031   jobc::Module("ReadoutSim")
00032 { 
00033   this->SetWatch("ReadoutSimConfig","default");
00034 }

ReadoutSim::~ReadoutSim  ) 
 

Definition at line 38 of file ReadoutSim.cxx.

References cfg::Observer::RemoveAllWatches().

00039 {
00040   this->RemoveAllWatches();
00041 }


Member Function Documentation

void ReadoutSim::ChooseSim std::string  s  ) 
 

Definition at line 64 of file ReadoutSim.cxx.

References mySim.

Referenced by Update().

00065 {
00066   
00067   //delete(mySim);
00068   
00069   if(!simtype.compare("SimpleReadout"))
00070   {
00071     mySim=new SimpleReadout();
00072   }
00073   else if(!simtype.compare("FarReadout"))
00074   {
00075     mySim=new FarReadout();
00076   } 
00077   else
00078   {
00079     mySim=new Simulator();
00080   }
00081 }

jobc::Result ReadoutSim::Reco edm::EventHandle evt  )  [virtual]
 

Reimplemented from jobc::Module.

Definition at line 83 of file ReadoutSim.cxx.

References edm::EventHandle::Header(), msglevel, mySim, edm::EventHandle::Raw(), jobc::Result, rsim::Simulator::SetGeom(), and storemcinfo.

00084 {
00085   
00086   if(msglevel>=DEBUG)   printf("ReadoutSim Reco called\n");
00087   if(mySim==NULL){
00088     if(msglevel>=FATAL)std::cout<<"Major Error: Simulator never chosen....\n";
00089     return jobc::kFailed;
00090   }
00091   
00092   /*
00093     vector<const sim::FLSHitList*> hitlist(0);
00094     assert_jobc(evt.DetSim().Get("./",hitlist),
00095               "No FLSHitLists found in DetSim() folder!");
00096   */
00097   
00098   vector<const photrans::PhotonSignal*> hitlist(0);
00099   // assert_jobc(evt.Raw().Get("./",hitlist),
00100   //      "No PhotonSignals found in DetSim() folder!");
00101   
00102   try{
00103     evt.Raw().Get("./",hitlist);
00104   }catch(...){return jobc::kFailed;}
00105   
00106   std::vector<rawdata::RawDigit> rawdigitout(0);
00107   std::vector<sim::MCDigitInfo> mcdigitout(0);
00108   
00109   // take the digit list and pass it to the simulator, which returns raw digits that have passed through the simulator
00110   if(msglevel>=INFO)  std::cout <<"using simulator "<<*mySim<<"\n";     
00111   if(msglevel>=INFO)  std::cout<<"evt with "<<hitlist.size()<<" events\n";
00112   
00113   short fDetGeom=1;  // would have det id from header idealy
00114   mySim->SetGeom( evt.Header().Run(), fDetGeom);
00115 
00116   rawdigitout = mySim->Simulate(hitlist, mcdigitout);
00117   
00118   //remove the raw digits from the root file from before the readout sim
00119   //    evt.Raw().ClearArrays();
00120   
00121   if(msglevel>=INFO) printf("   %d raw hits after simulation\n",rawdigitout.size());
00122   
00123   //put the new rawdigits
00124   for (unsigned int i=0; i<rawdigitout.size(); ++i)
00125     evt.Raw().Put(rawdigitout[i],"");
00126 
00127   // store MC info
00128   if(storemcinfo==1) {
00129     if (evt.Raw().GetFolder("./mcinfo")==0) 
00130       evt.Raw().MakeFolder("./mcinfo");
00131 
00132     /* cause bad_alloc error?
00133     for (unsigned int i=0; i<mcdigitout.size(); ++i)
00134       evt.Raw().Put(mcdigitout[i],"./mcinfo");
00135     */
00136   }    
00137 
00138   return jobc::kPassed;
00139 }

void ReadoutSim::Update const cfg::Config c  )  [virtual]
 

Implements cfg::Observer.

Definition at line 43 of file ReadoutSim.cxx.

References ChooseSim(), rsim::Simulator::Configure(), msglevel, mySim, and storemcinfo.

00044 {
00045   
00046   //choose which mySim to use
00047   
00048   //std::cout <<"ReadoutSim::Update called \n";
00049   std::string simtype;
00050   c("SimType").Get(simtype);
00051   c("MessageLevel").Get(msglevel);
00052   c("StoreMCInfo").Get(storemcinfo);
00053   
00054   ChooseSim(simtype);
00055   
00056   //vector<std::string> simconfig;
00057   //c("SimConfig").Get(simconfig);
00058   //mySim->Configure(simconfig);
00059   
00060   mySim->Configure(c);
00061   
00062 }


Member Data Documentation

int rsim::ReadoutSim::msglevel [private]
 

Definition at line 34 of file ReadoutSim.h.

Referenced by Reco(), and Update().

Simulator* rsim::ReadoutSim::mySim [private]
 

Definition at line 37 of file ReadoutSim.h.

Referenced by ChooseSim(), Reco(), and Update().

double rsim::ReadoutSim::pClockTick [private]
 

Definition at line 30 of file ReadoutSim.h.

double rsim::ReadoutSim::pDoublePulseTSep [private]
 

Definition at line 29 of file ReadoutSim.h.

float rsim::ReadoutSim::pPEThreshold [private]
 

Definition at line 27 of file ReadoutSim.h.

float rsim::ReadoutSim::pPeToADC [private]
 

Definition at line 32 of file ReadoutSim.h.

float rsim::ReadoutSim::pQuantumEff [private]
 

Definition at line 31 of file ReadoutSim.h.

double rsim::ReadoutSim::pSinglePulseTRes [private]
 

Definition at line 28 of file ReadoutSim.h.

int rsim::ReadoutSim::storemcinfo [private]
 

Definition at line 35 of file ReadoutSim.h.

Referenced by Reco(), and Update().


The documentation for this class was generated from the following files:
Generated on Thu Sep 4 02:05:35 2008 for NOvA Offline by doxygen 1.3.5