+//_____________________________________________________________________
+void AliCaloCalibSignal::WriteParametersToFile(const char *parameterFile)
+{ // write parameters to file
+ static const string delimitor("::");
+ ofstream out( parameterFile );
+ out << "// " << parameterFile << endl;
+ out << "fAmpCut" << "::" << fAmpCut << endl;
+ out << "fReqFractionAboveAmpCutVal" << "::" << fReqFractionAboveAmpCutVal << endl;
+ out << "fAmpCutLEDRef" << "::" << fAmpCutLEDRef << endl;
+ out << "fSecInAverage" << "::" << fSecInAverage << endl;
+ out << "fDownscale" << "::" << fDownscale << endl;
+
+ out.close();
+ return;
+}
+
+//_____________________________________________________________________
+Bool_t AliCaloCalibSignal::AddInfo(const AliCaloCalibSignal *sig)
+{
+ // note/FIXME: we are not yet adding correctly the info for fN{HighGain,LowGain,Ref} here - but consider this a feature for now (20080905): we'll do Analyze() unless entries were found for a tower in this original object.
+
+ // add info from sig's TTrees to ours..
+ TTree *sigAmp = sig->GetTreeAmpVsTime();
+ TTree *sigAvgAmp = sig->GetTreeAvgAmpVsTime();
+
+ // we could try some merging via TList or what also as a more elegant approach
+ // but I wanted with the stupid/simple and hopefully safe approach of looping
+ // over what we want to add..
+
+ // associate variables for sigAmp and sigAvgAmp:
+ sigAmp->SetBranchAddress("fChannelNum",&fChannelNum);
+ sigAmp->SetBranchAddress("fHour",&fHour);
+ sigAmp->SetBranchAddress("fAmp",&fAmp);
+
+ // loop over the trees.. note that since we use the same variables we should not need
+ // to do any assignments between the getting and filling
+ for (int i=0; i<sigAmp->GetEntries(); i++) {
+ sigAmp->GetEntry(i);
+ fTreeAmpVsTime->Fill();
+ }
+
+ sigAvgAmp->SetBranchAddress("fChannelNum",&fChannelNum);
+ sigAvgAmp->SetBranchAddress("fHour",&fHour);
+ sigAvgAmp->SetBranchAddress("fAvgAmp",&fAvgAmp);
+ sigAvgAmp->SetBranchAddress("fRMS",&fRMS);
+
+ for (int i=0; i<sigAvgAmp->GetEntries(); i++) {
+ sigAvgAmp->GetEntry(i);
+ fTreeAvgAmpVsTime->Fill();
+ }
+
+ // also LED..
+ TTree *sigLEDAmp = sig->GetTreeLEDAmpVsTime();
+ TTree *sigLEDAvgAmp = sig->GetTreeLEDAvgAmpVsTime();
+
+ // associate variables for sigAmp and sigAvgAmp:
+ sigLEDAmp->SetBranchAddress("fRefNum",&fRefNum);
+ sigLEDAmp->SetBranchAddress("fHour",&fHour);
+ sigLEDAmp->SetBranchAddress("fAmp",&fAmp);
+
+ // loop over the trees.. note that since we use the same variables we should not need
+ // to do any assignments between the getting and filling
+ for (int i=0; i<sigLEDAmp->GetEntries(); i++) {
+ sigLEDAmp->GetEntry(i);
+ fTreeLEDAmpVsTime->Fill();
+ }
+
+ sigLEDAvgAmp->SetBranchAddress("fRefNum",&fRefNum);
+ sigLEDAvgAmp->SetBranchAddress("fHour",&fHour);
+ sigLEDAvgAmp->SetBranchAddress("fAvgAmp",&fAvgAmp);
+ sigLEDAvgAmp->SetBranchAddress("fRMS",&fRMS);
+
+ for (int i=0; i<sigLEDAvgAmp->GetEntries(); i++) {
+ sigLEDAvgAmp->GetEntry(i);
+ fTreeLEDAvgAmpVsTime->Fill();
+ }
+
+ // We should also copy other pieces of info: counters and parameters
+ // (not number of columns and rows etc which should be the same)
+ // note that I just assign them here rather than Add them, but we
+ // normally just Add (e.g. in Preprocessor) one object so this should be fine.
+ fRunNumber = sig->GetRunNumber();
+ fStartTime = sig->GetStartTime();
+ fAmpCut = sig->GetAmpCut();
+ fReqFractionAboveAmpCutVal = sig->GetReqFractionAboveAmpCutVal();
+ fReqFractionAboveAmp = sig->GetReqFractionAboveAmp();
+ fAmpCutLEDRef = sig->GetAmpCutLEDRef();
+ fReqLEDRefAboveAmpCutVal = sig->GetReqLEDRefAboveAmpCutVal();
+ fHour = sig->GetHour();
+ fLatestHour = sig->GetLatestHour();
+ fUseAverage = sig->GetUseAverage();
+ fSecInAverage = sig->GetSecInAverage();
+ fDownscale = sig->GetDownscale();
+ fNEvents = sig->GetNEvents();
+ fNAcceptedEvents = sig->GetNAcceptedEvents();
+
+ return kTRUE;//We hopefully succesfully added info from the supplied object
+}
+
+//_____________________________________________________________________
+Bool_t AliCaloCalibSignal::ProcessEvent(AliRawReader *rawReader)
+{
+ // if fMapping is NULL the rawstream will crate its own mapping
+ AliCaloRawStreamV3 rawStream(rawReader, fCaloString, (AliAltroMapping**)fMapping);
+ if (fDetType == kEmCal) {
+ rawReader->Select("EMCAL", 0, AliEMCALGeoParams::fgkLastAltroDDL) ; //select EMCAL DDL range
+ }
+ return ProcessEvent( &rawStream, rawReader->GetTimestamp() );
+}