ScintCalDatabase Class Reference

#include <ScintCalDatabase.h>

List of all members.

Public Member Functions

 ScintCalDatabase ()
 ScintCalDatabase (Float_t binlength)
 ScintCalDatabase (std::string filename)
 ScintCalDatabase (const ScintCalDatabase &calData)
virtual ~ScintCalDatabase ()
virtual void ChainToFile (std::string filename)
virtual void ChainToFile (std::string filename, Double_t ts)
virtual void DoStuff (std::string directory)
virtual void DrawGraphs (std::string directory)
virtual void InfoObjectUpdate (ScintCalTimePeriod &infoIn)
virtual void NewBinLength (Float_t newLength)
virtual void NewMuon (const NtpSRDate *date)
virtual void SingleHitUpdate (const ScintCalData &data)
virtual void SingleTempUpdate (const NtpSRDate *date, const Float_t temp)
virtual void WriteToFile (std::string directory)
virtual void WriteToMINOSDbi ()
virtual void WriteToMINOSDbi (DetectorType::Detector_t detector, Int_t year, Int_t month, Int_t day, std::string recoversion)

Public Attributes

std::map< UInt_t,
ScintCalTimePeriod
fmdatabase

Private Attributes

Float_t fbinlength

Detailed Description

Definition at line 14 of file ScintCalDatabase.h.


Constructor & Destructor Documentation

ScintCalDatabase::ScintCalDatabase (  ) 

Definition at line 29 of file ScintCalDatabase.cxx.

00030 {
00031   fbinlength = 10800.0;
00032   //Default binlength is 3 hours.
00033   fmdatabase.clear();
00034 }

ScintCalDatabase::ScintCalDatabase ( Float_t  binlength  ) 

Definition at line 37 of file ScintCalDatabase.cxx.

References fbinlength, and fmdatabase.

00038 {
00039   //Constructor takes binlength in hours. It converts it to seconds.
00040   fbinlength = binlength*3600.0;
00041   fmdatabase.clear();
00042 }

ScintCalDatabase::ScintCalDatabase ( std::string  filename  ) 
ScintCalDatabase::ScintCalDatabase ( const ScintCalDatabase calData  ) 

Definition at line 91 of file ScintCalDatabase.cxx.

References fbinlength, and fmdatabase.

00092 {
00093   fbinlength = calData.fbinlength;
00094   fmdatabase = calData.fmdatabase;
00095 }

ScintCalDatabase::~ScintCalDatabase (  )  [virtual]

Definition at line 98 of file ScintCalDatabase.cxx.

00099 {
00100 }


Member Function Documentation

virtual void ScintCalDatabase::ChainToFile ( std::string  filename,
Double_t  ts 
) [virtual]
virtual void ScintCalDatabase::ChainToFile ( std::string  filename  )  [virtual]
virtual void ScintCalDatabase::DoStuff ( std::string  directory  )  [virtual]
virtual void ScintCalDatabase::DrawGraphs ( std::string  directory  )  [virtual]
void ScintCalDatabase::InfoObjectUpdate ( ScintCalTimePeriod infoIn  )  [virtual]

Definition at line 227 of file ScintCalDatabase.cxx.

References fmdatabase, it, ScintCalTimePeriod::Length(), and ScintCalTimePeriod::TimePeriod().

Referenced by NewBinLength().

00228 {
00229   //Find which time period the object is in
00230   UInt_t timeperiod = infoIn.TimePeriod();
00231   //Do we already have an info object for this period?
00232   map<UInt_t, ScintCalTimePeriod>::iterator it = fmdatabase.find(timeperiod);
00233   //If not, make one.
00234   std::cout << "2 attmept (nsmayer) " << std::endl;
00235   if (it == fmdatabase.end()){
00236     fmdatabase[timeperiod] = ScintCalTimePeriod(timeperiod, infoIn.Length());
00237     std::cout << "2 (nsmayer) " << fmdatabase.size() << std::endl;
00238     it = fmdatabase.find(timeperiod);
00239   }
00240   //Store the info object
00241   it->second = it->second + infoIn;
00242   return;
00243 }

void ScintCalDatabase::NewBinLength ( Float_t  newLength  )  [virtual]

Definition at line 246 of file ScintCalDatabase.cxx.

References fbinlength, fmdatabase, InfoObjectUpdate(), it, Msg::kInfo, Msg::kWarning, and MSG.

00247 {
00248   newLength *= 3600.0;
00249   //now newLength is in seconds
00250   //Make sure we're not stupidly trying to reduce bin size.
00251   if (newLength < fbinlength){
00252     MSG("ScintCalDatabase",Msg::kWarning)
00253       << "New bin length shorter than old bin length."
00254       << " Not doing anything to ScintCalDatabase object."
00255       << endl;
00256     return;
00257   }
00258 
00259   //Make a copy of this object's unaltered self.
00260   ScintCalDatabase oldData(*this);
00261   //Reset this object.
00262   std::cout << " (nsmayer) fmdatabase.clear() called here.  fmdatabase.size() before clear is? " << fmdatabase.size() << std::endl; 
00263   this->fmdatabase.clear();
00264   this->fbinlength = newLength;
00265   //Loop through the unaltered version of the original self
00266   //and fill the new self with the new info objects.
00267   for (map<UInt_t, ScintCalTimePeriod>::iterator 
00268          it = oldData.fmdatabase.begin();
00269        it != oldData.fmdatabase.end();
00270        ++it){
00271     //Find the new info object time periods
00272     Float_t oldPeriod = (Float_t) it->second.TimePeriod();
00273 //     if (oldPeriod < 309696.0){
00274 //       cout << "Ignoring period " << oldPeriod << endl;
00275 //       continue;}
00276     Float_t oldLength = (Float_t) oldData.fbinlength;
00277     UInt_t newTimePeriod =
00278       (UInt_t) floor( oldPeriod*oldLength/newLength );
00279     //Set the new info object's time members
00280     it->second.SetTimePeriod(newTimePeriod);
00281     it->second.SetBinLength((Double_t) newLength);
00282     //Fill the new self
00283     this->InfoObjectUpdate(it->second);
00284   MSG("ScintCalData", Msg::kInfo)
00285     << "Old length " << oldData.fbinlength 
00286     << " new data " << fbinlength 
00287     << " old period " << oldPeriod 
00288     << " new period " << newTimePeriod 
00289     << endl;
00290   }
00291   return;
00292 }

void ScintCalDatabase::NewMuon ( const NtpSRDate date  )  [virtual]

Definition at line 295 of file ScintCalDatabase.cxx.

References fbinlength, fmdatabase, it, Msg::kInfo, MSG, and NtpSRDate::utc.

Referenced by ScintCalModule::Ana().

00296 {
00297   //Find which timeperiod the muon was in.
00298   UInt_t timeperiod = (UInt_t) floor( ((Float_t) date->utc)/fbinlength );
00299   //Do we already have an info object for this period?
00300   map<UInt_t, ScintCalTimePeriod>::iterator it = fmdatabase.find(timeperiod);
00301   //If not, make one.
00302   //std::cout << "3 attmept (nsmayer) " << std::endl;
00303   if (it == fmdatabase.end()){
00304     fmdatabase[timeperiod] = ScintCalTimePeriod(timeperiod, fbinlength);
00305     //std::cout << "3 (nsmayer) " << fmdatabase.size() << std::endl;
00306     it = fmdatabase.find(timeperiod);
00307     MSG("ScintCalDatabase", Msg::kInfo)
00308       <<"Making timeperiod " << *date << endl;
00309   }
00310   it->second.NewMuon();
00311   return;
00312 }

void ScintCalDatabase::SingleHitUpdate ( const ScintCalData data  )  [virtual]

Definition at line 315 of file ScintCalDatabase.cxx.

References ScintCalData::Date(), fbinlength, fmdatabase, it, Msg::kInfo, MAXMSG, and MSG.

Referenced by ScintCalModule::Ana().

00316 {
00317   //Find which timeperiod the hit was in.
00318   UInt_t timeperiod =
00319     (UInt_t) floor( ((Float_t) data.Date().utc)/fbinlength );
00320   //Do we already have an info object for this period?
00321   map<UInt_t, ScintCalTimePeriod>::iterator it = fmdatabase.find(timeperiod);
00322   //If not, make one.
00323   //std::cout << "4 attmept (nsmayer) " << std::endl;
00324   if (it == fmdatabase.end()){
00325     fmdatabase[timeperiod] = ScintCalTimePeriod(timeperiod, fbinlength);
00326     //std::cout << "4 (nsmayer) " << fmdatabase.size() << std::endl;
00327     it = fmdatabase.find(timeperiod);
00328     MSG("ScintCalDatabase", Msg::kInfo)
00329       <<"Making timeperiod " << data.Date() << endl;
00330   }
00331   MAXMSG("ScintCalDatabase", Msg::kInfo,10)
00332     <<"have timeperiod " << data.Date() << endl;
00333     
00334   it->second.SingleHitUpdate(data);
00335   return;
00336 }

void ScintCalDatabase::SingleTempUpdate ( const NtpSRDate date,
const Float_t  temp 
) [virtual]

Definition at line 339 of file ScintCalDatabase.cxx.

References fbinlength, fmdatabase, it, Msg::kInfo, MSG, and NtpSRDate::utc.

Referenced by ScintCalModule::Ana().

00341 {
00342   UInt_t timeperiod = (UInt_t) floor( ((Float_t) date->utc)/fbinlength );
00343   map<UInt_t, ScintCalTimePeriod>::iterator it = fmdatabase.find(timeperiod);
00344   //std::cout << "5 attmept (nsmayer) " << std::endl;
00345   if (it == fmdatabase.end()){
00346     fmdatabase[timeperiod] = ScintCalTimePeriod(timeperiod, fbinlength);
00347     //std::cout << "5 (nsmayer) " << fmdatabase.size() << std::endl;
00348     it = fmdatabase.find(timeperiod);
00349   MSG("ScintCalDatabase", Msg::kInfo)
00350     <<"Making timeperiod " << *date << endl;
00351   }
00352   it->second.SingleTempUpdate(temp);
00353   return;
00354 }

virtual void ScintCalDatabase::WriteToFile ( std::string  directory  )  [virtual]
virtual void ScintCalDatabase::WriteToMINOSDbi ( DetectorType::Detector_t  detector,
Int_t  year,
Int_t  month,
Int_t  day,
std::string  recoversion 
) [virtual]
void ScintCalDatabase::WriteToMINOSDbi (  )  [virtual]

Definition at line 655 of file ScintCalDatabase.cxx.

References fmdatabase, it, Msg::kInfo, and MSG.

00656 {
00657 
00658   for (map<UInt_t, ScintCalTimePeriod>::iterator 
00659          it = fmdatabase.begin();
00660        it != fmdatabase.end();
00661        ++it){
00662     MSG("ScintCalDatabase", Msg::kInfo) 
00663       << "Writing " << it->second.TimePeriod() << " of "
00664       << fmdatabase.end()->second.TimePeriod()
00665       << " to database."
00666       << endl;
00667     it->second.WriteToMINOSDbi();
00668   }
00669   return;
00670 }


Member Data Documentation

Float_t ScintCalDatabase::fbinlength [private]

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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1