MIPCalScheme Class Reference

#include <MIPCalScheme.h>

Inheritance diagram for MIPCalScheme:
CalScheme CfgPromptConfigurable

List of all members.

Public Member Functions

 MIPCalScheme ()
virtual FloatErr GetMIP (FloatErr sigmap, const PlexStripEndId &seid=PlexStripEndId()) const
virtual FloatErr DecalMIP (FloatErr sigmip, const PlexStripEndId &seid) const
virtual void DoReset (const VldContext &context)
virtual void ConfigModified ()
virtual void PrintConfig (std::ostream &os) const

Private Member Functions

 ClassDef (MIPCalScheme, 0)

Private Attributes

DbiResultPtr< CalMIPCalibrationfResPtr
Int_t fTask
Double_t fDefaultSigCorPerMip

Detailed Description

Definition at line 19 of file MIPCalScheme.h.


Constructor & Destructor Documentation

MIPCalScheme::MIPCalScheme (  ) 

Definition at line 24 of file MIPCalScheme.cxx.

References Msg::kVerbose, MSG, and Registry::Set().

00025 {
00026  MSG("Calib",Msg::kVerbose) << "MIPCalScheme::MIPCalScheme" 
00027                                    << endl;
00028  Registry r;
00029  r.Set("defaultSigCorPerMip",565.0);
00030  r.Set("MIPCalMethod","TrackWindow");
00031  InitializeConfig(r);
00032 }


Member Function Documentation

MIPCalScheme::ClassDef ( MIPCalScheme  ,
 
) [private]

Reimplemented from CalScheme.

void MIPCalScheme::ConfigModified ( void   )  [virtual]

Apply new config params.

Reimplemented from CalScheme.

Definition at line 151 of file MIPCalScheme.cxx.

References fDefaultSigCorPerMip, fTask, Registry::Get(), CfgPromptConfigurable::GetConfig(), CalScheme::GetContext(), Msg::kError, MSG, and CalScheme::Reset().

00152 {                                               
00156   bool ok = true;
00157   ok=ok && GetConfig().Get("defaultSigCorPerMip",fDefaultSigCorPerMip);
00158 
00159   const char* str_source;
00160   ok=ok && GetConfig().Get("MIPCalMethod",str_source);
00161   if(strncasecmp(str_source,"cosmic",6)==0) fTask=0;
00162   else if(strncasecmp(str_source,"paul",4)==0) fTask=1;
00163   else if(strncasecmp(str_source,"ps",2)==0) fTask=2;
00164   else if(strncasecmp(str_source,"alt",3)==0) fTask=3;
00165   else if(strncasecmp(str_source,"TrackWindow",6)==0) fTask=10;
00166   else {
00167     MSG("Calib",Msg::kError) 
00168       <<"I don't understand the MIPCalMethod setting: "
00169       <<str_source<<endl;
00170     MSG("Calib",Msg::kError)
00171       <<"Valid settings are: TrackWindow, Cosmics, Paul's Cosmics, PS muons, and Alternative PS muons"<<endl;
00172     MSG("Calib",Msg::kError) 
00173       <<"Defaulting to MIPCalMethod=window"<<endl;
00174     fTask=10;
00175   }
00176 
00177   if(!ok) MSG("Calib",Msg::kError)
00178     <<"Problem configuring MIPCalScheme."<<endl;
00179 
00180   // Force a re-query of the DB for this event.
00181   this->Reset(GetContext(),true); 
00182 }

FloatErr MIPCalScheme::DecalMIP ( FloatErr  sigmip,
const PlexStripEndId seid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Get atttenuation correction

Input: True energy of hit in MIPs Strip end (may be ignored, depending on implimentation)

Output: SigMaps that this hit will result in.

Must be implimented by: MIPCalScheme

Reimplemented from CalScheme.

Definition at line 86 of file MIPCalScheme.cxx.

References PlexStripEndId::AsString(), PlexStripEndId::BuildPlnStripEndKey(), fDefaultSigCorPerMip, fResPtr, DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), DbiResultPtr< T >::GetRowByIndex(), CalMIPCalibration::GetScale(), CalScheme::IncrementErrors(), PlexStripEndId::IsValid(), CalScheme::kMIPCalibrator, CalScheme::kMissingRow, Msg::kWarning, and MAXMSG.

00088 {
00101   
00102   // If there is more than one row in the table, look up the seid
00103   // Otherwise, assume that the first row applies to the whole detector.
00104 
00105   const CalMIPCalibration* mipcal;
00106   
00107   if(fResPtr.GetNumRows()==1) {                
00108     // Return the only row
00109     mipcal = fResPtr.GetRow(0);
00110   } else {
00111     if(!seid.IsValid()) {
00112       // We've been handed 'no row in particular'. Use the first one.
00113       mipcal = fResPtr.GetRow(0);
00114     } else {
00115       // Use the row given.
00116       mipcal = fResPtr.GetRowByIndex(seid.BuildPlnStripEndKey());
00117     }
00118   }
00119 
00120   if(mipcal ==0) {
00121     if(fResPtr.GetNumRows()>0) {
00122       MAXMSG("Calib",Msg::kWarning,10) 
00123         << "MIPCalScheme: No database row for StripEnd " << seid.AsString() << "\n";
00124       
00125       IncrementErrors(kMIPCalibrator,kMissingRow,seid);
00126     }
00127 
00128     return mip * (float)fDefaultSigCorPerMip;
00129   }
00130   
00131   
00132   return mip * mipcal->GetScale();
00133 }

void MIPCalScheme::DoReset ( const VldContext context  )  [virtual]

Reimplemented from CalScheme.

Definition at line 136 of file MIPCalScheme.cxx.

References VldContext::AsString(), fResPtr, fTask, DbiResultPtr< T >::GetNumRows(), CalScheme::IncrementErrors(), CalScheme::kMIPCalibrator, CalScheme::kMissingTable, Msg::kVerbose, Msg::kWarning, MAXMSG, MSG, and DbiResultPtr< T >::NewQuery().

00137 {
00138   MSG("Calib",Msg::kVerbose) << "MIPCalScheme::DoReset()" << endl;
00139   
00140   fResPtr.NewQuery(context,fTask);
00141   
00142   if(fResPtr.GetNumRows()==0) {
00143     MAXMSG("Calib",Msg::kWarning,10) 
00144       << "No rows in database table with validity context "
00145       << context.AsString() << "  No calibration will be applied." << endl;
00146     IncrementErrors(kMIPCalibrator,kMissingTable);
00147   }  
00148 }

FloatErr MIPCalScheme::GetMIP ( FloatErr  sigmap,
const PlexStripEndId seid = PlexStripEndId() 
) const [virtual]

Purpose: Convert from corrected charge to energy units. MIPs are usually defined as the the light seen from a muon going in the Z-direction through the center of the strip (i.e. ~2 MeV of muon energy)

In: sigcorr or sigmap Strip end (May be ignored, depending upon implimentation)

Out: energy in MIPs

Must be implimented by: MIPCalScheme

Reimplemented from CalScheme.

Definition at line 35 of file MIPCalScheme.cxx.

References PlexStripEndId::AsString(), PlexStripEndId::BuildPlnStripEndKey(), fDefaultSigCorPerMip, fResPtr, DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRow(), DbiResultPtr< T >::GetRowByIndex(), CalMIPCalibration::GetScale(), CalScheme::IncrementErrors(), PlexStripEndId::IsValid(), CalScheme::kMIPCalibrator, CalScheme::kMissingRow, Msg::kWarning, and MAXMSG.

00037 {
00050   
00051   // If there is more than one row in the table, look up the seid
00052   // Otherwise, assume that the first row applies to the whole detector.
00053 
00054   const CalMIPCalibration* mipcal;
00055   
00056 
00057   if(fResPtr.GetNumRows()==1) {
00058     // There is only one row. Use it.
00059     mipcal = fResPtr.GetRow(0);
00060   } else { 
00061     if(!seid.IsValid()) {
00062       // We've been given no particular strip end. Use the first row
00063       mipcal = fResPtr.GetRow(0);
00064     } else {
00065       // Use the row for this particular strip end.
00066       mipcal = fResPtr.GetRowByIndex(seid.BuildPlnStripEndKey());
00067     }
00068   }
00069 
00070   if(mipcal ==0) {
00071     if(fResPtr.GetNumRows()>0) {
00072       MAXMSG("Calib",Msg::kWarning,10) 
00073         << "MIPCalScheme: No database row for StripEnd " << seid.AsString() << "\n";
00074       
00075       IncrementErrors(kMIPCalibrator,kMissingRow,seid);
00076     }
00077     
00078     return sigcor / (float)fDefaultSigCorPerMip;
00079   }
00080   
00081   return sigcor / mipcal->GetScale();
00082 }

void MIPCalScheme::PrintConfig ( std::ostream &  os  )  const [virtual]

Reimplemented from CalScheme.

Definition at line 185 of file MIPCalScheme.cxx.

References fDefaultSigCorPerMip, fTask, Registry::GetCharString(), and CfgPromptConfigurable::GetConfig().

00186 {
00187   os<<"  Using MIPCalMethod="<<GetConfig().GetCharString("MIPCalMethod")
00188     <<" (DB task="<<fTask<<")"<<endl
00189     <<"  Default SigCor/SigMap per MIP="<<fDefaultSigCorPerMip<<endl;
00190 }


Member Data Documentation

Definition at line 34 of file MIPCalScheme.h.

Referenced by ConfigModified(), DecalMIP(), GetMIP(), and PrintConfig().

Definition at line 32 of file MIPCalScheme.h.

Referenced by DecalMIP(), DoReset(), and GetMIP().

Int_t MIPCalScheme::fTask [private]

Definition at line 33 of file MIPCalScheme.h.

Referenced by ConfigModified(), DoReset(), and PrintConfig().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1