CDAnaModule Class Reference

#include <CDAnaModule.h>

Inheritance diagram for CDAnaModule:
JobCModule

List of all members.

Public Member Functions

 CDAnaModule ()
 ~CDAnaModule ()
JobCResult Ana (const MomNavigator *mom)
void EndJob ()

Private Attributes

Double_t fPrevEvT
Double_t fPrevEvT1
Double_t fPrevEvT2
Double_t fNextEvT
Double_t fNextEvT1
Double_t fNextEvT2
Double_t fT
Double_t fT1
Double_t fT2
Double_t smallestT1
Double_t largestT2
Int_t fSnarl
Int_t fRun
Int_t fSubrun
Int_t fSec
Detector::Detector_t fDetector
TFile * fOutFile
TH1F * htEarliest
TH1F * htLatest
TH1F * htEarliestScint
TH1F * htLatestScint
TH1F * hdt
TH1F * hdtZoom
TH1F * hdtDeadChips
TProfile * pTimeVsdt
TGraph * gTimeVsdt
TGraph * gAdcVsTime
TGraph * gAdcVsTimeZoom
TGraph * gTtagTime
TGraph * gTtagTimeZoom

Detailed Description

Definition at line 24 of file CDAnaModule.h.


Constructor & Destructor Documentation

CDAnaModule::CDAnaModule (  ) 

Definition at line 37 of file CDAnaModule.cxx.

References fDetector, fNextEvT, fNextEvT1, fNextEvT2, fOutFile, fPrevEvT, fPrevEvT1, fPrevEvT2, fRun, fSec, fSnarl, fSubrun, fT, fT1, fT2, gAdcVsTime, gAdcVsTimeZoom, gTimeVsdt, gTtagTime, gTtagTimeZoom, hdt, hdtDeadChips, hdtZoom, htEarliest, htEarliestScint, htLatest, htLatestScint, Detector::kUnknown, largestT2, pTimeVsdt, and smallestT1.

00038 {
00039   fSnarl=-1;
00040   fRun=-1;
00041   fSubrun=-1;
00042   fSec=-1;
00043   fDetector=Detector::kUnknown;
00044   
00045   fPrevEvT=-2;
00046   fPrevEvT1=-2;
00047   fPrevEvT2=-2;
00048   fNextEvT=-1;
00049   fNextEvT1=-1;
00050   fNextEvT2=-1;
00051   fT=-1;
00052   fT1=-1;
00053   fT2=-1;
00054 
00055   smallestT1=1e10;
00056   largestT2=0;
00057 
00058   string sFileName="cdTiming.root";
00059   fOutFile=new TFile(sFileName.c_str(),"RECREATE");
00060 
00061   htEarliest=new TH1F("htEarliest","htEarliest",4000,0,1e9);
00062   htEarliest->GetXaxis()->SetTitle("Time in second");
00063   htEarliest->GetXaxis()->CenterTitle();
00064   htEarliest->GetYaxis()->SetTitle("");
00065   htEarliest->GetYaxis()->CenterTitle();
00066   htEarliest->SetFillColor(0);
00067   //htEarliest->SetBit(TH1::kCanRebin);
00068 
00069   htEarliestScint=new TH1F("htEarliestScint","htEarliestScint",
00070                                  4000,0,1e9);
00071   htEarliestScint->GetXaxis()->SetTitle("Time in second (VA scint)");
00072   htEarliestScint->GetXaxis()->CenterTitle();
00073   htEarliestScint->GetYaxis()->SetTitle("");
00074   htEarliestScint->GetYaxis()->CenterTitle();
00075   htEarliestScint->SetFillColor(0);
00076   //htEarliestScint->SetBit(TH1::kCanRebin);
00077 
00078   htLatest=new TH1F("htLatest","htLatest",4000,0,1e9);
00079   htLatest->GetXaxis()->SetTitle("Time in second");
00080   htLatest->GetXaxis()->CenterTitle();
00081   htLatest->GetYaxis()->SetTitle("");
00082   htLatest->GetYaxis()->CenterTitle();
00083   htLatest->SetFillColor(0);
00084   //htLatest->SetBit(TH1::kCanRebin);
00085 
00086   htLatestScint=new TH1F("htLatestScint","htLatestScint",
00087                                4000,0,1e9);
00088   htLatestScint->GetXaxis()->SetTitle("Time in second (VA scint)");
00089   htLatestScint->GetXaxis()->CenterTitle();
00090   htLatestScint->GetYaxis()->SetTitle("");
00091   htLatestScint->GetYaxis()->CenterTitle();
00092   htLatestScint->SetFillColor(0);
00093   //htLatestScint->SetBit(TH1::kCanRebin);
00094 
00095   hdt=new TH1F("hdt","hdt",1000,0,1e9);
00096   hdt->GetXaxis()->SetTitle("dt (ns)");
00097   hdt->GetXaxis()->CenterTitle();
00098   hdt->GetYaxis()->SetTitle("");
00099   hdt->GetYaxis()->CenterTitle();
00100   hdt->SetFillColor(0);
00101   //hdt->SetBit(TH1::kCanRebin);
00102 
00103   hdtZoom=new TH1F("hdtZoom","hdtZoom",200,0,200000);
00104   hdtZoom->GetXaxis()->SetTitle("dt (ns)");
00105   hdtZoom->GetXaxis()->CenterTitle();
00106   hdtZoom->GetYaxis()->SetTitle("");
00107   hdtZoom->GetYaxis()->CenterTitle();
00108   hdtZoom->SetFillColor(0);
00109   //hdtZoom->SetBit(TH1::kCanRebin);
00110 
00111   hdtDeadChips=new TH1F("hdtDeadChips","hdtDeadChips",
00112                               200,0,200000);
00113   hdtDeadChips->GetXaxis()->SetTitle("dt (ns)");
00114   hdtDeadChips->GetXaxis()->CenterTitle();
00115   hdtDeadChips->GetYaxis()->SetTitle("");
00116   hdtDeadChips->GetYaxis()->CenterTitle();
00117   hdtDeadChips->SetFillColor(0);
00118   hdtDeadChips->SetLineColor(2);
00119 
00120   pTimeVsdt=new TProfile("pTimeVsdt","pTimeVsdt",
00121                                    20000,0,800000);
00122   pTimeVsdt->GetXaxis()->SetTitle("dt (ns)");
00123   pTimeVsdt->GetXaxis()->CenterTitle();
00124   pTimeVsdt->GetYaxis()->SetTitle("Time in second");
00125   pTimeVsdt->GetYaxis()->CenterTitle();
00126   //hdtDeadChips->SetFillColor(0);
00127   //hdtDeadChips->SetLineColor(2);
00128   //hdtDeadChips->SetBit(TH1::kCanRebin);
00129 
00130   gTimeVsdt=new TGraph(200);
00131   gTimeVsdt->SetName("gTimeVsdt");
00132   gTimeVsdt->SetTitle("Time in second vs delta T (all in ns)");
00133   //gTimeVsdt->GetXaxis()->SetTitle("dt (ns)");
00134   //gTimeVsdt->GetXaxis()->CenterTitle();
00135   //gTimeVsdt->GetYaxis()->SetTitle("Time in second");
00136   //gTimeVsdt->GetYaxis()->CenterTitle();
00137   //hdtDeadChips->SetFillColor(0);
00138   gTimeVsdt->SetMarkerColor(2);
00139   gTimeVsdt->SetMarkerStyle(8);
00140 
00141   gAdcVsTime=new TGraph(200);
00142   gAdcVsTime->SetName("gAdcVsTime");
00143   gAdcVsTime->SetTitle("ADC vs Time");
00144   //gAdcVsTime->GetXaxis()->SetTitle("dt (ns)");
00145   //gAdcVsTime->GetXaxis()->CenterTitle();
00146   //gAdcVsTime->GetYaxis()->SetTitle("Time in second");
00147   //gAdcVsTime->GetYaxis()->CenterTitle();
00148   //hdtDeadChips->SetFillColor(0);
00149   gAdcVsTime->SetMarkerColor(2);
00150   gAdcVsTime->SetMarkerStyle(8);
00151 
00152   gAdcVsTimeZoom=new TGraph(10);
00153   gAdcVsTimeZoom->SetName("gAdcVsTimeZoom");
00154   gAdcVsTimeZoom->SetTitle("ADC vs Time (zoom)");
00155   //gAdcVsTimeZoom->GetXaxis()->SetTitle("dt (ns)");
00156   //gAdcVsTimeZoom->GetXaxis()->CenterTitle();
00157   //gAdcVsTimeZoom->GetYaxis()->SetTitle("Time in second");
00158   //gAdcVsTimeZoom->GetYaxis()->CenterTitle();
00159   //hdtDeadChips->SetFillColor(0);
00160   gAdcVsTimeZoom->SetMarkerColor(2);
00161   gAdcVsTimeZoom->SetMarkerStyle(8);
00162 
00163   gTtagTime=new TGraph(1);
00164   gTtagTime->SetName("gTtagTime");
00165   gTtagTime->SetTitle("TTag time(s)");
00166   //gTtagTime->GetXaxis()->SetTitle("dt (ns)");
00167   //gTtagTime->GetXaxis()->CenterTitle();
00168   //gTtagTime->GetYaxis()->SetTitle("Time in second");
00169   //gTtagTime->GetYaxis()->CenterTitle();
00170   //hdtDeadChips->SetFillColor(0);
00171   gTtagTime->SetMarkerColor(4);
00172   gTtagTime->SetMarkerStyle(8);
00173 
00174   gTtagTimeZoom=new TGraph(1);
00175   gTtagTimeZoom->SetName("gTtagTimeZoom");
00176   gTtagTimeZoom->SetTitle("TTag time(s)");
00177   //gTtagTimeZoom->GetXaxis()->SetTitle("dt (ns)");
00178   //gTtagTimeZoom->GetXaxis()->CenterTitle();
00179   //gTtagTimeZoom->GetYaxis()->SetTitle("Time in second");
00180   //gTtagTimeZoom->GetYaxis()->CenterTitle();
00181   //hdtDeadChips->SetFillColor(0);
00182   gTtagTimeZoom->SetMarkerColor(4);
00183   gTtagTimeZoom->SetMarkerStyle(8);
00184 }

CDAnaModule::~CDAnaModule (  ) 

Definition at line 188 of file CDAnaModule.cxx.

References fOutFile, gAdcVsTime, gAdcVsTimeZoom, gTimeVsdt, gTtagTime, and gTtagTimeZoom.

00189 {
00190   if (fOutFile){
00191     gTimeVsdt->Write();
00192     gAdcVsTime->Write();
00193     gAdcVsTimeZoom->Write();
00194     gTtagTime->Write();
00195     gTtagTimeZoom->Write();
00196     fOutFile->cd();
00197     fOutFile->Write();
00198     fOutFile->Close();
00199   }
00200 }


Member Function Documentation

JobCResult CDAnaModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 204 of file CDAnaModule.cxx.

References fDetector, RawRecord::FindRawBlock(), fNextEvT, fNextEvT1, fNextEvT2, Form(), fPrevEvT, fPrevEvT1, fPrevEvT2, fRun, fSec, fSnarl, fSubrun, fT, fT1, fT2, gAdcVsTime, gAdcVsTimeZoom, RawDigit::GetADC(), RawDigit::GetChannel(), RawChannelId::GetCrate(), RawDigitDataBlock::GetDatumIter(), VldContext::GetDetector(), RawChannelId::GetElecType(), MomNavigator::GetFragment(), RawDigitDataBlock::GetNumberOfDigits(), RawDeadChipBlock::GetNumberOfEntries(), RawRecord::GetRawHeader(), RawDaqHeader::GetRun(), VldTimeStamp::GetSec(), RawDaqSnarlHeader::GetSnarl(), RawDaqHeader::GetSubRun(), RawDigit::GetTDC(), VldContext::GetTimeStamp(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChannel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RecMinosHdr::GetVldContext(), RawChannelId::GetVmm(), gTimeVsdt, gTtagTime, gTtagTimeZoom, hdt, hdtDeadChips, hdtZoom, htEarliest, htEarliestScint, htLatest, htLatestScint, RawChannelId::IsSameChannel(), it, Detector::kCalDet, Msg::kInfo, JobCResult::kPassed, ElecType::kQIE, ElecType::kVA, Msg::kVerbose, Msg::kWarning, largestT2, MAXMSG, MSG, pTimeVsdt, Munits::second, JobCResult::SetFailed(), and smallestT1.

00205 {
00206   JobCResult result(JobCResult::kPassed);
00207 
00208   RawRecord *rr=dynamic_cast<RawRecord *>
00209     (mom->GetFragment("RawRecord"));
00210   if (rr==0) {
00211     MSG("CDTrackerModule", Msg::kWarning) 
00212       <<"No RawRecord in MOM." << endl;
00213     result.SetFailed();
00214     return result;
00215   }
00216   
00217   const RawDaqSnarlHeader* snarlHdr =
00218     dynamic_cast<const RawDaqSnarlHeader*>(rr->GetRawHeader());
00219   if(snarlHdr){
00220     fSnarl=snarlHdr->GetSnarl();
00221     fRun=snarlHdr->GetRun();
00222     fSubrun=snarlHdr->GetSubRun();
00223     fSec=snarlHdr->GetVldContext().GetTimeStamp().GetSec();
00224     fDetector=snarlHdr->GetVldContext().GetDetector();
00225   }
00226   else{
00227     MSG("CDTrackerModule", Msg::kWarning) 
00228       <<"No RawDaqSnarlHeader in MOM."<<endl;
00229     result.SetFailed();
00230     return result;
00231   }
00232 
00233   const RawDeadChipBlock* deadblock=
00234     dynamic_cast<const RawDeadChipBlock*>
00235     (rr->FindRawBlock("RawDeadChipBlock"));
00236   Int_t numDeadChips=-1;
00237   if(deadblock) {
00238     numDeadChips=deadblock->GetNumberOfEntries();
00239   }
00240 
00241   const RawDigitDataBlock *rddb=dynamic_cast<const RawDigitDataBlock *>
00242     (rr->FindRawBlock("RawDigitDataBlock"));
00243 
00244   Double_t earliestT=1e10;
00245   Double_t latestT=0;
00246   Double_t earliestScintT=1e10;
00247   Double_t latestScintT=0;
00248 
00249   //times taken from Calibrator::GetTDCConvert
00250   Double_t secsPerVaTick=25/16.;//(640MHz)
00251   Double_t secsPerQieTick=1000./53.1;// clock is 53.1MHz
00252 
00253   //CalDet has yet a different clock frequency
00254   if (fDetector==Detector::kCalDet){
00255     secsPerQieTick=1.5625*16.0*58.0/77.0;
00256   }
00257 
00258   MAXMSG("CDTrackerModule", Msg::kVerbose,1000) 
00259     <<"secsPerVaTick="<<secsPerVaTick<<endl;
00260 
00261   /*
00262 
00263 Large dt: snarl=1784, sec=1033300996, numDeadChips=1
00264 Previous time=(813178545.3 -> 813178825.0)
00265                      dt=1335.373 us
00266 This one time=(814514198.4 -> 814514475.0)
00267                      dt=13596.958 us
00268 Next     time=(828111432.8 -> 828111700.0)
00269 
00270   */
00271 
00272   
00273   Int_t second=1063522292;//1033300999;//1033301498;//1033300996;//1033302919;//1033300999//1033301517
00274   //second=2000000000;
00275   Bool_t skipSeconds=false;
00276   if (skipSeconds){
00277     if (fSec<second){
00278       MAXMSG("CDTrackerModule",Msg::kInfo,1)
00279         <<endl<<"Skipping seconds to get to second="<<second
00280         <<"..."<<endl;
00281       return result;    
00282     }
00283     if (fSec>second) {
00284       MAXMSG("CDTrackerModule",Msg::kInfo,1)
00285         <<endl<<"Not looking at any more seconds beyond second="<<second
00286         <<"..."<<endl;
00287       return result;
00288     }
00289   }
00290 
00291   Int_t lemoCounter=0;
00292   vector<Double_t> lemoTimes(6,-1);
00293   Double_t ttagTime=-1;
00294   Int_t ttagAdc=-1;
00295   Double_t dtLemoTtag=-1;
00296   Double_t dtLemoTtagMin=1e9;
00297   static Bool_t foundQie=false;
00298 
00299   //looping to find particular channel
00300   if (rddb) {
00301     TIter it=rddb->GetDatumIter();
00302     while (TObject *obj=it.Next()) {
00303       RawDigit* rvd=dynamic_cast<RawDigit*>(obj);
00304       if (rvd) {
00305 
00306         //take out the timing fid from each snarl...
00307         RawChannelId timingFid(Detector::kCalDet,ElecType::kVA,
00308                                0,2,5,1,2,16);
00309         if (timingFid.IsSameChannel(rvd->GetChannel())) continue;
00310         
00311         //use va first then check if qie
00312         Double_t time=(rvd->GetTDC())*secsPerVaTick;
00313         if (rvd->GetChannel().GetElecType()==ElecType::kQIE){
00314           foundQie=true;
00315           time=(rvd->GetTDC())*secsPerQieTick;
00316           string sTime=Form("%.1f",time);
00317           MAXMSG("CDTrackerModule", Msg::kInfo,100)
00318             <<"TDC="<<rvd->GetTDC()
00319             <<", time="<<sTime
00320             <<", ADC="<<rvd->GetADC()
00321             <<", chan="<<rvd->GetChannel().GetVaChannel()
00322             <<endl;
00323         }
00324         
00325         Int_t adc=rvd->GetADC();
00326         if (rvd->GetChannel().GetVmm()==6){
00327           Int_t lemoVarc=rvd->GetChannel().GetVarcId();
00328           Int_t lemoCrate=rvd->GetChannel().GetCrate();
00329           Int_t lemoIndex=lemoCrate*3+lemoVarc;
00330           string sTime=Form("%.1f",time);
00331           MAXMSG("CDTrackerModule", Msg::kInfo,100)
00332             <<"TDC="<<rvd->GetTDC()
00333             <<", time="<<sTime
00334             <<", ADC="<<rvd->GetADC()
00335             <<", chan="<<rvd->GetChannel().GetVaChannel()
00336             <<", crate="<<lemoCrate
00337             <<", varc="<<lemoVarc
00338             <<", index="<<lemoIndex
00339             <<endl;
00340           lemoCounter++;
00341           
00342           //find the largest lemo ttag time diff
00343           Double_t dt=time-ttagTime;
00344           if (dt>dtLemoTtag) dtLemoTtag=dt;
00345           if (dt<dtLemoTtagMin) dtLemoTtagMin=dt;
00346           
00347           if (lemoIndex<6){
00348             lemoTimes[lemoIndex]=time;
00349           }
00350           else cout<<"ahhhhh strange lemo..."<<endl;
00351         }
00352         else if (rvd->GetChannel().GetVmm()==5){
00353           RawChannelId ttag(Detector::kCalDet,ElecType::kVA,
00354                             0,2,5,1,1,16);
00355           if (ttag.IsSameChannel(rvd->GetChannel())){
00356             ttagTime=time;
00357             ttagAdc=adc;
00358             string sTime=Form("%.1f",time);
00359             MAXMSG("CDTrackerModule", Msg::kInfo,20) 
00360               <<"Found ttag, time="<<sTime<<", adc="<<ttagAdc<<endl;
00361             static Int_t tti=0;
00362             gTtagTime->SetPoint(tti,time,adc);
00363             tti++;
00364           }
00365         }
00366 
00367         //calc times
00368         if (time>latestT) latestT=time;
00369         if (time<earliestT) earliestT=time;
00370         if (rvd->GetChannel().GetVmm()<5){
00371           if (time>latestScintT) latestScintT=time;
00372           if (time<earliestScintT) earliestScintT=time;
00373         }
00374 
00375         //store all the hits in a particular second
00376         if (fSec==second){
00377           static Int_t i=0;
00378           gAdcVsTime->SetPoint(i,time,rvd->GetADC());
00379           i++;
00380           
00381           //now look at the zoom
00382           Double_t timeInSec=78137900;//330610000;//467440000;//467649000;//331466423.4;//828111432.8;//385630640.6;//4.67649e8;
00383           Double_t gate=70e3;//ns so 200 us
00384           //Double_t gate=20000e6;
00385           if (time>timeInSec-gate && time<timeInSec+gate){
00386             static Int_t i2=0;
00387             gAdcVsTimeZoom->SetPoint(i2,time,rvd->GetADC());
00388             i2++;
00389             string sTime=Form("%.1f",time);
00390             MAXMSG("CDTrackerModule", Msg::kInfo,1000) 
00391               <<"Sec="<<fSec<<", TDC="<<rvd->GetTDC()
00392               <<", time="<<sTime
00393               <<", ADC="<<rvd->GetADC()
00394               <<", vmm="<<rvd->GetChannel().GetVmm()
00395               <<","<<rvd->GetChannel().GetVaAdcSel()
00396               <<","<<rvd->GetChannel().GetVaChip()
00397               <<","<<rvd->GetChannel().GetVaChannel()
00398               <<endl;
00399 
00400             //fill graph for ttag
00401             if (rvd->GetChannel().GetVmm()==5){
00402               RawChannelId ttag(Detector::kCalDet,ElecType::kVA,
00403                                 0,2,5,1,1,16);
00404               if (ttag.IsSameChannel(rvd->GetChannel())){
00405                 static Int_t tti=0;
00406                 gTtagTimeZoom->SetPoint(tti,time,adc);
00407                 tti++;
00408               }
00409             }
00410           }
00411           else{
00412             MAXMSG("CDTrackerModule", Msg::kVerbose,1000) 
00413               <<"Not in gate: sec="<<fSec<<", TDC="<<rvd->GetTDC()
00414               <<", time="<<time
00415               <<", ADC="<<rvd->GetADC()<<endl;
00416           }
00417         }
00418         else if (fSnarl==18926){
00419           string sTime=Form("%.1f",time);
00420           MAXMSG("CDTrackerModule", Msg::kInfo,1000) 
00421             <<"snl="<<fSnarl<<", Sec="<<fSec<<", TDC="<<rvd->GetTDC()
00422             <<", time="<<sTime
00423             <<", ADC="<<rvd->GetADC()<<endl;
00424         }
00425       }
00426     }
00427   }
00428   else{
00429     MSG("CDTrackerModule", Msg::kWarning) 
00430       <<"No RawDigitDataBlock"<<endl;
00431     result.SetFailed();
00432     return result;
00433   }
00434 
00435   if ((lemoCounter!=6 && !foundQie) || (lemoCounter!=3 && foundQie)){
00436     string sTimeEarliest=Form("%.1f",earliestT);
00437     string sTimeLatest=Form("%.1f",latestT);
00438     MAXMSG("CDTrackerModule", Msg::kInfo,1000) 
00439       <<"snarl="<<fSnarl<<", sec="<<fSec
00440       <<", lemoCount="<<lemoCounter
00441       <<", rddbNum="<<rddb->GetNumberOfDigits()
00442       <<", time=("<<sTimeEarliest<<" -> "<<sTimeLatest<<")"<<endl;
00443   }
00444 
00445   MAXMSG("CDTrackerModule", Msg::kInfo,10) 
00446     <<"snarl="<<fSnarl<<", sec="<<fSec<<" Lemodt="<<dtLemoTtag
00447     <<", lemo="<<lemoCounter
00448     <<", #rddb="<<rddb->GetNumberOfDigits()
00449     <<", t=("<<earliestT<<" -> "<<latestT<<")"<<endl;
00450 
00451   if ((dtLemoTtag>150 || dtLemoTtagMin<5) && ttagTime>0){
00452     string sTimeEarliest=Form("%.1f",earliestT);
00453     string sTimeLatest=Form("%.1f",latestT);
00454     string sTimeTtag=Form("%.1f",ttagTime);
00455     string sdtLemoTtag=Form("%.1f",dtLemoTtag);
00456     string sdtLemoTtagMin=Form("%.1f",dtLemoTtagMin);
00457     
00458       MAXMSG("CDTrackerModule", Msg::kInfo,100) 
00459       <<"** snl="<<fSnarl//<<", sec="<<fSec
00460       <<" Ldt="<<sdtLemoTtag
00461       <<"->"<<sdtLemoTtagMin
00462       <<", #L="<<lemoCounter
00463       <<", #d="<<rddb->GetNumberOfDigits()<<endl
00464       <<"    ttagTime="<<sTimeTtag
00465       <<", t=("<<sTimeEarliest<<" -> "<<sTimeLatest<<")"<<endl;
00466   }
00467 
00468   //set them to something named appropriately
00469   fNextEvT1=earliestT;
00470   fNextEvT2=latestT;
00471   fNextEvT=fSec;
00472 
00473   string sPrevEvT1=Form("%.1f",fPrevEvT1);
00474   string sPrevEvT2=Form("%.1f",fPrevEvT2);
00475   string sT1=Form("%.1f",fT1);
00476   string sT2=Form("%.1f",fT2);
00477   string sNextEvT1=Form("%.1f",fNextEvT1);
00478   string sNextEvT2=Form("%.1f",fNextEvT2);
00479 
00480   //calculate the delta Ts and check that same second
00481   Double_t pre_dt=fT1-fPrevEvT2;
00482   Double_t post_dt=fNextEvT1-fT2;
00483   string sPre_dt=Form("%.3f",(pre_dt/1000.));
00484   if (fT!=fPrevEvT) {
00485     pre_dt=1e9;//no good
00486     sPre_dt="wrap around";
00487   }
00488   string sPost_dt=Form("%.3f",(post_dt/1000));
00489   if (fT!=fNextEvT) {
00490     post_dt=1e9;//no good
00491     sPost_dt="wrap around";
00492   }
00493 
00494   //fill the histos
00495   htEarliest->Fill(earliestT);
00496   htLatest->Fill(latestT);
00497   htEarliestScint->Fill(earliestScintT);
00498   htLatestScint->Fill(latestScintT);
00499   hdt->Fill(post_dt);
00500   hdtZoom->Fill(post_dt);
00501 
00502   if (numDeadChips>0){
00503     hdtDeadChips->Fill(post_dt);
00504     pTimeVsdt->Fill(post_dt,earliestT);
00505     if (gTimeVsdt){
00506       static Int_t i=1;
00507       gTimeVsdt->SetPoint(i,post_dt,earliestT);
00508       i++;
00509     }
00510     else cout<<"ahhhh"<<endl;
00511 
00512     if (post_dt>10e6 && post_dt<1e9){// ms!
00513       MAXMSG("CDTrackerModule", Msg::kInfo,100) 
00514         <<endl
00515         <<"Large dt: snarl="<<fSnarl-1<<", sec="<<fSec
00516         <<", numDeadChips="<<numDeadChips<<endl
00517         <<"Previous time=("<<sPrevEvT1<<" -> "<<sPrevEvT2<<")"<<endl
00518         <<"                     dt="<<sPre_dt<<" us"<<endl
00519         <<"This one time=("<<sT1<<" -> "<<sT2<<")"<<endl
00520         <<"                     dt="<<sPost_dt<<" us"<<endl
00521         <<"Next     time=("<<sNextEvT1<<" -> "<<sNextEvT2<<")"<<endl
00522         <<endl;
00523     }
00524   }
00525 
00526   if (post_dt<49000){
00527     MAXMSG("CDTrackerModule", Msg::kInfo,100) 
00528       <<endl
00529       <<"Snarl="<<fSnarl-1<<", sec="<<fSec
00530       <<", numDeadChips="<<numDeadChips<<endl
00531       <<"Previous time=("<<sPrevEvT1<<" -> "<<sPrevEvT2<<")"<<endl
00532       <<"                     dt="<<sPre_dt<<" us"<<endl
00533       <<"This one time=("<<sT1<<" -> "<<sT2<<")"<<endl
00534       <<"                     dt="<<sPost_dt<<" us"<<endl
00535       <<"Next     time=("<<sNextEvT1<<" -> "<<sNextEvT2<<")"<<endl
00536       <<endl;
00537   }
00538 
00539   //cascade the values down
00540   fPrevEvT1=fT1;
00541   fPrevEvT2=fT2;
00542   fPrevEvT=fT;
00543   fT1=earliestT;
00544   fT2=latestT;
00545   fT=fSec;
00546 
00547   //work out the times nearest the boundaries
00548   if (earliestT<smallestT1) smallestT1=earliestT;
00549   if (latestT>largestT2) largestT2=latestT;
00550 
00551   //return the final result
00552   return result;
00553 }

void CDAnaModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 557 of file CDAnaModule.cxx.

References Form(), fRun, Msg::kInfo, largestT2, MSG, and smallestT1.

00558 {
00559   string sLower_dt=Form("%.3f",(smallestT1/1000.));//us
00560   string sUpper_dt=Form("%.3f",((1e9-largestT2)/1000.));//us
00561 
00562   MSG("CDTrackerModule", Msg::kInfo) 
00563     <<"Times closest to timeframe boundaries in run "<<fRun<<endl
00564     <<"  Lower time: "<<smallestT1<<" (dt="<<sLower_dt<<" us)"<<endl
00565     <<"  Upper time: "<<largestT2<<" (dt="<<sUpper_dt<<" us)"
00566     <<endl;
00567 }


Member Data Documentation

Definition at line 54 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::fNextEvT [private]

Definition at line 40 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::fNextEvT1 [private]

Definition at line 41 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::fNextEvT2 [private]

Definition at line 42 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

TFile* CDAnaModule::fOutFile [private]

Definition at line 56 of file CDAnaModule.h.

Referenced by CDAnaModule(), and ~CDAnaModule().

Double_t CDAnaModule::fPrevEvT [private]

Definition at line 37 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::fPrevEvT1 [private]

Definition at line 38 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::fPrevEvT2 [private]

Definition at line 39 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Int_t CDAnaModule::fRun [private]

Definition at line 51 of file CDAnaModule.h.

Referenced by Ana(), CDAnaModule(), and EndJob().

Int_t CDAnaModule::fSec [private]

Definition at line 53 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Int_t CDAnaModule::fSnarl [private]

Definition at line 50 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Int_t CDAnaModule::fSubrun [private]

Definition at line 52 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::fT [private]

Definition at line 43 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::fT1 [private]

Definition at line 44 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::fT2 [private]

Definition at line 45 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

TGraph* CDAnaModule::gAdcVsTime [private]

Definition at line 68 of file CDAnaModule.h.

Referenced by Ana(), CDAnaModule(), and ~CDAnaModule().

TGraph* CDAnaModule::gAdcVsTimeZoom [private]

Definition at line 69 of file CDAnaModule.h.

Referenced by Ana(), CDAnaModule(), and ~CDAnaModule().

TGraph* CDAnaModule::gTimeVsdt [private]

Definition at line 67 of file CDAnaModule.h.

Referenced by Ana(), CDAnaModule(), and ~CDAnaModule().

TGraph* CDAnaModule::gTtagTime [private]

Definition at line 70 of file CDAnaModule.h.

Referenced by Ana(), CDAnaModule(), and ~CDAnaModule().

TGraph* CDAnaModule::gTtagTimeZoom [private]

Definition at line 71 of file CDAnaModule.h.

Referenced by Ana(), CDAnaModule(), and ~CDAnaModule().

TH1F* CDAnaModule::hdt [private]

Definition at line 62 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

TH1F* CDAnaModule::hdtDeadChips [private]

Definition at line 64 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

TH1F* CDAnaModule::hdtZoom [private]

Definition at line 63 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

TH1F* CDAnaModule::htEarliest [private]

Definition at line 58 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Definition at line 60 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

TH1F* CDAnaModule::htLatest [private]

Definition at line 59 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

TH1F* CDAnaModule::htLatestScint [private]

Definition at line 61 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::largestT2 [private]

Definition at line 48 of file CDAnaModule.h.

Referenced by Ana(), CDAnaModule(), and EndJob().

TProfile* CDAnaModule::pTimeVsdt [private]

Definition at line 65 of file CDAnaModule.h.

Referenced by Ana(), and CDAnaModule().

Double_t CDAnaModule::smallestT1 [private]

Definition at line 47 of file CDAnaModule.h.

Referenced by Ana(), CDAnaModule(), and EndJob().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1