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

OltTimePlot.cxx

Go to the documentation of this file.
00001 
00002 // $Id: OltTimePlot.cxx,v 1.6 2006/05/22 19:33:13 rhatcher Exp $
00003 //
00004 // OltBlockPlot.cxx
00005 //
00006 // Block Plot
00007 //
00008 // Author: Phil Adamson 5/2002
00010 
00011 #include "JobControl/JobCModuleRegistry.h"
00012 #include "MinosObjectMap/MomNavigator.h"
00013 #include "OfflineTrigger/OltTimePlot.h"
00014 #include "MessageService/MsgService.h"
00015 #include "RawData/RawRecord.h"
00016 #include "RawData/RawHeader.h"
00017 #include "RawData/RawDataBlock.h"
00018 #include "RawData/RawDaqHeaderBlock.h"
00019 #include "RawData/RawSnarlHeaderBlock.h"
00020 #include "RawData/RawChannelId.h"
00021 #include "RawData/RawVaDigit.h"
00022 #include "RawData/RawQieDigit.h"
00023 #include "RawData/RawDigitDataBlock.h"
00024 #include "RawData/RawRunCommentBlock.h"
00025 #include "RawData/RawDeadChipBlock.h"
00026 
00027 #include "Persistency/PerOutputStreamManager.h"
00028 #include "Persistency/PerOutputStream.h"
00029 #include "Rotorooter/RotoObjectifier.h"
00030 #include "Plex/PlexHandle.h"
00031 #include "Plex/PlexSEIdAltL.h"
00032 #include "Validity/VldContext.h"
00033 
00034 #include "TString.h"
00035 #include "TFile.h"
00036 #include "TH1.h"
00037 #include "TH2.h"
00038 #include <string>
00039 
00040 #include <algorithm>
00041 #include <cstdio>
00042 #include <cstring>
00043 #include <iostream>
00044 #include <fstream>
00045 #include <map>
00046 #ifndef __CINT__
00047 #include "OnlineUtil/mdBlockDefinitions.h"
00048 #endif
00049 ClassImp(OltTimePlot)
00050 
00051  // ......
00052 
00053 //CVSID("$Id: OltTimePlot.cxx,v 1.6 2006/05/22 19:33:13 rhatcher Exp $");
00054 JOBMODULE(OltTimePlot,"OltTimePlot","The Offline Trigger Time Plotner");
00055 
00056 
00057 OltTimePlot::OltTimePlot()
00058 {
00059   TDirectory *save = gDirectory;
00060   fFile = new TFile("/home/pa/timeplot.root","RECREATE");
00061   save->cd();
00062   fPlex = 0;
00063 }
00064 
00065 OltTimePlot::~OltTimePlot()
00066 {
00067   TDirectory *save = gDirectory;
00068   fFile->cd();
00069   fFile->Close();
00070   save->cd();
00071 }
00072 
00073 JobCResult OltTimePlot::Reco(MomNavigator* mom)
00074 {
00075   int snarl=0,tf=0;
00076   TIter iter = mom->FragmentIter();
00077   while (TObject *obj = iter.Next()) {
00078     RawRecord *rawrec = dynamic_cast<RawRecord *>(obj);
00079     if (rawrec) {
00080       TIter recit = rawrec->GetRawBlockIter();
00081       while (TObject *obj = recit.Next()) {
00082         RawDataBlock *rawdata = dynamic_cast<RawDataBlock *>(obj);
00083         if (rawdata) {
00084           if (rawdata->InheritsFrom("RawSnarlHeaderBlock")) {
00085             RawSnarlHeaderBlock *rshb =dynamic_cast<RawSnarlHeaderBlock *>(rawdata);
00086              tf = rshb->GetTimeFrameNo();
00087              snarl = rshb->GetSnarl();
00088              if (!fPlex) fPlex = new PlexHandle(rshb->GetVldContext());
00089           }
00090           
00091           RawDigitDataBlock *rddb = dynamic_cast<RawDigitDataBlock *>(rawdata);
00092           if (rddb) {
00093             RawChannelId id(Detector::kCalDet,
00094                             ElecType::kVA,0,0x1602);
00095             id.SetModeBits(true,true,true);
00096             map<int,int> times;
00097             int t0 = 0;
00098             TIter it = rddb->GetDatumIter();
00099             while (TObject *obj = it.Next()) {
00100               RawVaDigit *rvd = dynamic_cast<RawVaDigit *>(obj);
00101               if (rvd) {
00102                 RawChannelId rcid = rvd->GetChannel();
00103                 PlexSEIdAltL altl= fPlex->GetSEIdAltL(rcid);
00104 
00105                 times.insert(make_pair(rvd->GetTDC(),altl.GetPlane()));
00106 //cout<<rvd->GetChannel()<<" "<<id<<endl;
00107                 if (rcid == id) t0 = rvd->GetTDC();
00108               }
00109             }
00110             TDirectory *save = gDirectory;
00111             char hname[100];
00112             sprintf(hname,"snarl%d",snarl);
00113             TH1F h(hname,hname,200,-1000,1000);
00114             sprintf(hname,"psnarl%d",snarl);
00115             TH2F hh(hname,hname,50,-1000,1000,30,0,60);
00116             for (map<int,int>::iterator it =
00117 times.begin();it!=times.end();it++) {
00118               h.Fill((*it).first-t0);
00119               hh.Fill((*it).first-t0,(*it).second);
00120 //cout<<(*it)<<"  "<<t0<<endl;
00121             }
00122             fFile->cd();
00123             h.Write();
00124             hh.Write();
00125             save->cd();
00126           }
00127         }
00128       }
00129     }
00130   }
00131   return JobCResult::kAOK;
00132 }
00133  
00134 const Registry& OltTimePlot::DefaultConfig() const
00135 {
00136 
00137   static Registry r; // Default configuration for module
00138 
00139 
00140   std::string name = this->JobCModule::GetName();
00141   name += ".config.default";
00142   r.SetName(name.c_str());
00143 
00144   // Set values in configuration
00145   r.UnLockValues();
00146 
00147   r.LockValues();
00148 
00149   return r;
00150 }
00151 
00152 //......................................................................
00153 
00154 void OltTimePlot::Config(const Registry& /* r */)
00155 {
00156   //int   tmpb;
00157 
00158 }
00159 

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