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

AlgPassThru.cxx

Go to the documentation of this file.
00001 
00002 #include <cassert>
00003 
00004 #include "Calibrator/Calibrator.h"
00005 #include "CandData/CandRecord.h"
00006 #include "MuonRemoval/AlgPassThru.h"
00007 #include "CandDigit/CandDigitHandle.h"
00008 #include "Candidate/CandContext.h"
00009 #include "Conventions/Munits.h"
00010 #include "MessageService/MsgService.h"
00011 #include "Plex/PlexHandle.h"
00012 #include "Plex/PlexSEIdAltL.h"
00013 #include "RawData/RawChannelId.h"
00014 #include "RawData/RawDigit.h"
00015 #include "RawData/RawHeader.h"
00016 #include "RawData/RawRecord.h"
00017 #include "Validity/VldContext.h"
00018 
00019 #include "Algorithm/AlgConfig.h"
00020 
00021 
00022 ClassImp(AlgPassThru)
00023 
00024 CVSID("$Id: AlgPassThru.cxx,v 1.2 2008/05/07 19:30:57 tjyang Exp $");
00025 
00026 
00027 AlgPassThru::AlgPassThru()
00028 {
00029 }
00030 
00031 AlgPassThru::~AlgPassThru()
00032 {
00033 }
00034 
00035 void AlgPassThru::RunAlg(AlgConfig &ac , CandHandle &ch, CandContext &cx)
00036 {
00037  
00038   assert(ch.InheritsFrom("CandDigitHandle"));
00039 
00040   //
00041   //Alg config
00042   //
00043   int cZeroWeights = 1;
00044   int cDoScale = 0;
00045   double cScaleFactor = 1.;
00046   double tmpf = 0;
00047   int tmpi = 0;
00048   if(ac.Get("ZeroWeights", tmpi)) cZeroWeights = tmpi;  
00049   if(ac.Get("doscale", tmpi)) cDoScale = tmpi;  
00050   if(ac.Get("scalefactor", tmpf)) cScaleFactor = tmpf;  
00051 
00052   //
00053   //Setup output digit
00054   //
00055   CandDigitHandle &digitout = (CandDigitHandle &) ch;
00056   
00057   //
00058   //Get the input data
00059   //
00060   const TObjArray* input = dynamic_cast<const TObjArray*>(cx.GetDataIn());
00061   if(input==NULL){
00062     MSG("RmMu", Msg::kError) << " Unable to get input data "<<endl;
00063     return;
00064   }
00065   
00066   const CandDigitHandle* digitin = dynamic_cast<const CandDigitHandle*> (input->At(0));
00067   assert(digitin);
00068   
00069   //copy over everything blindly
00070   RawChannelId channel(digitin->GetChannelId());
00071   digitout.SetChannelId(channel);
00072   digitout.SetTime(digitin->GetTime(CalTimeType::kNone));
00073   digitout.SetVaErrorBits(digitin->GetVaErrorBits());
00074   digitout.SetQieErrorBits(digitin->GetQieErrorBits());
00075   digitout.SetRawDigitIndex(digitin->GetRawDigitIndex());  
00076 
00077   if(cDoScale==0){
00078     digitout.SetCharge(digitin->GetCharge(CalDigitType::kNone));
00079   }else{    
00080     if(channel.GetElecType() == ElecType::kVA)
00081       digitout.SetVaErrorBits(digitin->GetVaErrorBits() | 0x80);
00082     else
00083       digitout.SetQieErrorBits(digitin->GetQieErrorBits() | 0x80);
00084 
00085     digitout.SetCharge(digitin->GetCharge(CalDigitType::kNone)*cScaleFactor);
00086   }
00087 
00088 
00089   if(cZeroWeights==0){
00090     //retain the demux solutions
00091     PlexSEIdAltL psalt(digitin->GetPlexSEIdAltL());
00092     digitout.SetPlexSEIdAltL(psalt);
00093   }else{
00094     //re-multiplex the solution
00095     const VldContext &vldc = *(cx.GetCandRecord()->GetVldContext());
00096     Calibrator& calibrator = Calibrator::Instance();
00097     calibrator.Reset(vldc);        
00098     PlexHandle ph(vldc);
00099     PlexSEIdAltL altlist = ph.GetSEIdAltL(channel, 
00100                                           &(calibrator), 
00101                                           (int)(digitin->GetCharge(CalDigitType::kNone)), 
00102                                           digitin->GetTime());
00103     digitout.SetPlexSEIdAltL(altlist);
00104   }
00105 }
00106 
00107 //______________________________________________________________________
00108 void AlgPassThru::Trace(const char * /* c */) const
00109 {
00110 }

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