testTracedFEMMerger.C

Go to the documentation of this file.
00001 void testTracedFEMMerger()
00002 {
00003   PHTimeStamp start1(2004,1,1,0,0,0);
00004   PHTimeStamp start2(2004,1,1,0,0,20);
00005 
00006   PHTimeStamp end;
00007   end.setToFarFuture();
00008 
00009   int nchannels = 1;
00010 
00011   emcTracedFEM* t1 = new emcGainFEM(0,start1,end);
00012   t1->SetNumberOfChannels(nchannels);
00013   emcTracedFEM* t2 = new emcGainFEM(0,start2,end);
00014   t2->SetNumberOfChannels(nchannels);
00015 
00016   t1->SetXmin(start1.getTics());
00017   t2->SetXmin(start2.getTics());
00018 
00019   time_t day = 5;
00020 
00021   t1->SetXmax(t1->GetXmin()+3*day);
00022   t2->SetXmax(t2->GetXmin()+5*day);
00023 
00024   time_t x1 = 1*day;
00025   double c1 = 150;
00026   double s1 = 10;
00027 
00028   time_t x2 = 2*day;
00029   double c2 = 140;
00030   double s2 = -10;
00031 
00032   t1->AddNewItem(0,new emcTracedValue(x1,c1,s1));
00033   t1->AddNewItem(0,new emcTracedValue(x2,c2,s2));
00034 
00035   t2->AddNewItem(0,new emcTracedValue(x1,c1+20,s1));
00036 
00037   t1->Print(cout,1);
00038   t2->Print(cout,1);
00039 
00040   emcTracedFEM* m = emcTracedFEMMerger::merge(*t1,*t2);
00041 
00042   m->Print(cout,1);
00043 
00044   emcTracedFEMPlotter pm(*m,0);
00045   emcTracedFEMPlotter pt1(*t1,0);
00046   emcTracedFEMPlotter pt2(*t2,t2->GetXmin()-t1->GetXmin());
00047 
00048   TGraph* gm = pm.CopyGraph(0);
00049   TGraph* g1 = pt1.CopyGraph(0);
00050   TGraph* g2 = pt2.CopyGraph(0);
00051 
00052   TH2* h = new TH2F("h","h",10,0,m->GetXmax()-m->GetXmin(),
00053                     10,0,500);
00054   h->Draw();
00055 
00056   gm->Draw("LP");
00057 
00058   g2->SetLineColor(2);
00059   g2->Draw("LP");
00060 
00061   g1->SetLineColor(4);
00062   g1->Draw("LP");
00063 
00064 
00065 }