ROOTANA
TV1720Correlations.cxx
Go to the documentation of this file.
1 #include "TV1720Correlations.h"
2 
3 #include "TV1720RawData.h"
4 #include "TDirectory.h"
5 
7 
8 
9 
11 
12  // check if we already have histogramss.
13  char tname[100];
14  sprintf(tname,"V1720_Correlations_%i",0);
15 
16  TH2D *tmp = (TH2D*)gDirectory->Get(tname);
17  if (tmp) return;
18 
19  // Otherwise make histograms
20  clear();
21 
22  for(int i = 0; i < 8; i++){ // loop over 8 channels
23 
24  char name[100];
25  char title[100];
26  sprintf(name,"V1720_Correlations_%i",i);
27 
28  sprintf(title,"V1720 Max ADC vs Max ADC time ch=%i",i);
29 
30  TH2D *tmp = new TH2D(name, title, 100,0,2000,100,0,1000);
31  //TH2D *tmp = new TH2D(name, title, 4,0,2000,5,0,1000);
32  tmp->SetXTitle("max ADC time (ns)");
33  tmp->SetYTitle("max bin value");
34 
35  push_back(tmp);
36  }
37 
38 }
39 
40 
42 
43  TV1720RawData *v1720 = dataContainer.GetEventData<TV1720RawData>("W200");
44 
45  if(v1720 && v1720->IsZLECompressed()){
46 
47  // NOTHING
48  // can't handle compressed data yet...
49  }
50 
51  if(v1720 && !v1720->IsZLECompressed()){
52 
53  for(int i = 0; i < 8; i++){ // loop over channels
54 
55  TV1720RawChannel channelData = v1720->GetChannelData(i);
56  if(channelData.GetNSamples() <= 0) continue;
57 
58  double max_adc_value = -1.0;
59  double max_adc_time = -1;
60 
61 
62  for(int j = 0; j < channelData.GetNSamples(); j++){
63  double adc = channelData.GetADCSample(j);
64  if(adc > max_adc_value){
65  max_adc_value = adc;
66  max_adc_time = j * 4.0; // 4ns per bin
67  }
68 
69  }
70 
71  GetHistogram(i)->Fill(max_adc_time,max_adc_value);
72 
73  // As test, set any event where time for max bin < 200 as 'interesting'
74  if(max_adc_time < 400) iem_t::instance()->SetInteresting();
75 
76  }
77  }
78 
79 
80 }
81 
82 
83 
85 
86 
87  for(int i = 0; i < 8; i++){ // loop over channels
88  GetHistogram(i)->Reset();
89 
90  }
91 }
R__EXTERN TDirectory * gDirectory
T * GetEventData(const char *name)
Add a templated function that returns event data in the format that we want.
virtual TObject * Get(const char *namecycle)
TH1 * GetHistogram(unsigned i)
A helper method for accessing each histogram. Does bounds checking.
static TInterestingEventManager * instance()
void SetInteresting()
Set this event to be interesting.
void CreateHistograms()
Function to create histograms; users will want to implement this function.
void UpdateHistograms(TDataContainer &dataContainer)
Update the histograms for this canvas.
int GetNSamples() const
Get the ADC sample for a particular bin (for uncompressed data).
Definition: TV1720RawData.h:71
int GetADCSample(int i) const
Get the ADC sample for a particular bin (for uncompressed data).
Definition: TV1720RawData.h:74
TV1720RawChannel GetChannelData(int i)
Get Channel Data.
bool IsZLECompressed() const
Is the V1720 data ZLE compressed?