1 #include "ThermalChain.h" 2 #include "SummarySet.h" 4 #include "TEntryList.h" 5 #include "ProgressBar.h" 7 #include "AnitaDataset.h" 10 Acclaim::ThermalChain::ThermalChain(
const char* glob,
const char* treeName){
12 fChain =
new TChain(treeName);
15 TString hiCalGlob(glob);
16 hiCalGlob.ReplaceAll(
"makeThermalTree",
"makeHiCalTree");
18 fFriendChain1 =
new TChain(
"hiCalTree");
19 fFriendChain1->Add(hiCalGlob);
21 TString surfaceGlob(glob);
22 surfaceGlob.ReplaceAll(
"makeThermalTree",
"makeSurfaceTree");
24 fFriendChain2 =
new TChain(
"surfaceTree");
25 fFriendChain2->Add(surfaceGlob);
28 fChain->AddFriend(fFriendChain1);
29 fChain->AddFriend(fFriendChain2);
31 gROOT->ProcessLine(
"#include \"FFTtools.h\"");
34 fEntryListDirty =
true;
41 Acclaim::ThermalChain::~ThermalChain(){
44 fChain->SetEntryList(0);
64 void Acclaim::ThermalChain::setBranches(){
67 fChain->SetBranchAddress(
"pol", &polFloat);
68 fChain->SetBranchAddress(
"peakInd", &peakIndFloat);
69 fChain->SetBranchAddress(
"eventNumber", &eventNumberInt);
70 fChain->SetBranchAddress(
"realTime", &realTimeInt);
72 fChain->SetBranchAddress(
"run", &run);
73 fChain->SetBranchAddress(
"peak_phi", &peak_phi);
74 fChain->SetBranchAddress(
"peak_theta", &peak_theta);
75 fChain->SetBranchAddress(
"anitaLocation_longitude", &anita_longitude);
76 fChain->SetBranchAddress(
"anitaLocation_latitude", &anita_latitude);
77 fChain->SetBranchAddress(
"anitaLocation_altitude", &anita_altitude);
78 fChain->SetBranchAddress(
"anitaLocation_heading", &anita_heading);
79 fChain->SetBranchAddress(
"coherent_filtered_snr", &coherent_filtered_snr);
80 fChain->SetBranchAddress(
"weight", &weight);
81 fChain->SetBranchAddress(
"mc_energy", &mc_energy);
83 fChain->SetBranchAddress(
"peak_value", &peak_value);
84 fChain->SetBranchAddress(
"coherent_filtered_peakHilbert", &coherent_filtered_peakHilbert);
85 fChain->SetBranchAddress(
"deconvolved_filtered_peakHilbert", &deconvolved_filtered_peakHilbert);
86 fChain->SetBranchAddress(
"coherent_filtered_impulsivityMeasure", &coherent_filtered_impulsivityMeasure);
87 fChain->SetBranchAddress(
"deconvolved_filtered_impulsivityMeasure", &deconvolved_filtered_impulsivityMeasure);
88 fChain->SetBranchAddress(
"coherent_filtered_fracPowerWindowGradient", &coherent_filtered_fracPowerWindowGradient);
89 fChain->SetBranchAddress(
"deconvolved_filtered_fracPowerWindowGradient", &deconvolved_filtered_fracPowerWindowGradient);
92 fFriendChain1->SetBranchAddress(
"duringHiCal", &duringHiCal);
93 fFriendChain1->SetBranchAddress(
"hiCalPhi", &hiCalPhi);
94 fFriendChain1->SetBranchAddress(
"hiCalTheta", &hiCalTheta);
95 fFriendChain1->SetBranchAddress(
"eventNumber2", &eventNumber2);
96 fFriendChain1->SetBranchAddress(
"run2", &run2);
99 fFriendChain2->SetBranchAddress(
"longitude", &longitude);
100 fFriendChain2->SetBranchAddress(
"latitude", &latitude);
101 fFriendChain2->SetBranchAddress(
"altitude", &altitude);
102 fFriendChain2->SetBranchAddress(
"thetaAdjustmentRequired", &thetaAdjustmentRequired);
103 fFriendChain2->SetBranchAddress(
"onContinent", &onContinent);
104 fFriendChain2->SetBranchAddress(
"onIceShelf", &onIceShelf);
105 fFriendChain2->SetBranchAddress(
"iceThickness", &iceThickness);
106 fFriendChain2->SetBranchAddress(
"eventNumber3", &eventNumber3);
107 fFriendChain2->SetBranchAddress(
"run3", &run3);
158 fEntryListDirty =
true;
163 void Acclaim::ThermalChain::SetUseProof(
bool useProof){
167 fChain->SetProof(useProof);
168 fUseProof = useProof;
176 void Acclaim::ThermalChain::makeSelection()
const {
180 fChain->SetEntryList(0);
185 fChain->SetProof(
false);
187 std::cout <<
"Info in " << __PRETTY_FUNCTION__ <<
", updating fEntryList..." << std::endl;
189 fChain->Draw(
">>fEntryList", fCut,
"entrylist");
190 fEntryList =
dynamic_cast<TEntryList*
>(gROOT->FindObject(
"fEntryList"));
192 std::cerr <<
"Error! couldn't find fEntryList!" << std::endl;
195 fEntryListDirty =
false;
196 fChain->SetEntryList(fEntryList);
200 fChain->SetProof(fUseProof);
213 return fEntryList->GetN();
216 Long64_t Acclaim::ThermalChain::getEntry(Long64_t entry){
219 Int_t treeIndex = -1;
220 Long64_t treeEntry = fEntryList->GetEntryAndTree(entry,treeIndex);
221 Long64_t chainEntry = treeEntry+fChain->GetTreeOffset()[treeIndex];
223 Long64_t retVal = fChain->GetEntry(chainEntry);
230 void Acclaim::ThermalChain::doTypeConversions(){
232 peakInd = (Int_t) peakIndFloat;
233 eventNumber = (UInt_t) eventNumberInt;
234 realTime = (UInt_t) realTimeInt;
236 if(eventNumber2 != eventNumber || run2 != run){
237 std::cerr <<
"Error in " << __PRETTY_FUNCTION__ <<
", mismatch in friendChain1!" << std::endl;
239 if(eventNumber3 != eventNumber || run3 != run){
240 std::cerr <<
"Error in " << __PRETTY_FUNCTION__ <<
", mismatch in friendChain2!" << std::endl;
247 Long64_t Acclaim::ThermalChain::getEvent(UInt_t eventNumber){
255 AnitaVersion::setVersionFromUnixTime(realTime);
256 fAnitaVersion = AnitaVersion::get();
261 TString desiredFileName = TString::Format(
"makeThermalTree_%d_", run);
262 TIter next(fChain->GetListOfFiles());
263 Int_t desiredTreeNumber = -1;
264 while(TObject* f = next()){
266 TString fileName = f->GetTitle();
267 if(fileName.Contains(desiredFileName)){
274 if(desiredTreeNumber > -1 && desiredTreeNumber < fChain->GetListOfFiles()->GetEntries()){
277 Long64_t entry = fChain->GetTreeOffset()[desiredTreeNumber];
278 fChain->GetEntry(entry);
283 const int maxTries = 50;
284 for(
int numTries = 0; numTries < maxTries; numTries++){
287 Int_t deltaEntries = eventNumber - this->eventNumber;
288 entry += deltaEntries;
291 Long64_t nb = fChain->GetEntry(entry);
295 if(this->eventNumber == eventNumber){
302 std::cerr <<
"Error in " << __PRETTY_FUNCTION__ <<
", unable to find eventNumber " 303 << eventNumber <<
" after " << maxTries <<
" attempts, giving up!" << std::endl;
306 std::cerr <<
"Error in " << __PRETTY_FUNCTION__ <<
", unable to find file corresponding to run " << run << std::endl;
311 Adu5Pat Acclaim::ThermalChain::pat(){
323 Double_t Acclaim::ThermalChain::fisherDiscriminant(){
331 return 0.898497+(1.929594*coherent_filtered_fracPowerWindowGradient/deconvolved_filtered_fracPowerWindowGradient)+(-0.195909*deconvolved_filtered_fracPowerWindowGradient)+(5.943355*coherent_filtered_impulsivityMeasure)+(0.826114*deconvolved_filtered_impulsivityMeasure)+(0.021763*coherent_filtered_peakHilbert)+(-0.012670*deconvolved_filtered_peakHilbert)+(-0.394201*peak_value);
void setCut(const TCut &cut)
Adu5Pat – The ADU5 Position and Attitude Data.
static TProof * startProof()
You take it, you own it, you delete it.
Float_t latitude
In degrees.
Float_t longitude
In degrees.
UInt_t realTime
Time from the GPS unit.
void addCut(const TCut &cut)
Float_t altitude
In metres.
Float_t heading
0 is facing north, 180 is facing south
enum AnitaPol::EAnitaPol AnitaPol_t
Polarisation enumeration.
static int getRunContainingEventNumber(UInt_t eventNumber)
Get the run that contains the eventNumber.