From 97b4001ecb2d8b6ebc891f38fc0da5517cef430f Mon Sep 17 00:00:00 2001 From: cholm Date: Wed, 27 Dec 2006 13:37:57 +0000 Subject: [PATCH] Added script to extract list of medias and write to file - must be executed in same process as the creation of the galice.root file --- FMD/AliFMDDetector.cxx | 2 +- FMD/AliFMDDisplay.cxx | 27 ++++++---- FMD/AliFMDInput.cxx | 15 +++++- FMD/AliFMDPattern.cxx | 9 ++-- FMD/scripts/MediaTable.C | 100 ++++++++++++++++++++++++++++++++++++ FMD/scripts/PatternDigits.C | 7 ++- 6 files changed, 141 insertions(+), 19 deletions(-) create mode 100644 FMD/scripts/MediaTable.C diff --git a/FMD/AliFMDDetector.cxx b/FMD/AliFMDDetector.cxx index 2674f633e9e..cda0443cca0 100644 --- a/FMD/AliFMDDetector.cxx +++ b/FMD/AliFMDDetector.cxx @@ -328,7 +328,7 @@ AliFMDDetector::SetAlignableVolumes() const // Get the node path next.GetPath(path); - align = Form("FMD/FMD%d%c", fId, thisHalf); + align = Form("FMD/FMD%d_%c", fId, thisHalf); } // if the detector was found, then we're on that branch, and we diff --git a/FMD/AliFMDDisplay.cxx b/FMD/AliFMDDisplay.cxx index 9270ddef743..7629d6edc23 100644 --- a/FMD/AliFMDDisplay.cxx +++ b/FMD/AliFMDDisplay.cxx @@ -137,9 +137,9 @@ AliFMDDisplay::MakeCanvas(const char** which) yb = .05; fSlider = new TSlider("multCut", "Multiplicity cut", 0, 0, 1, yb); fSlider->SetMethod("AliFMDDisplay::Instance()->ChangeCut()"); - fSlider->SetMinimum(TESTBIT(fTreeMask, kESD) ? fMultCut : - fPedestalFactor * 10); fSlider->Draw(); + fSlider->SetMinimum(TESTBIT(fTreeMask, kESD) ? fMultCut * 10 : + fPedestalFactor * 10); } const char** p = which; const char* m; @@ -280,6 +280,9 @@ AliFMDDisplay::Init() AliFMDGeometry* geom = AliFMDGeometry::Instance(); geom->Init(); geom->InitTransformations(); + if (TESTBIT(fTreeMask, kDigits) || TESTBIT(fTreeMask, kRaw)) + AliFMDParameters::Instance()->Init(); + fMarkers = new TObjArray; fHits = new TObjArray; fMarkers->SetOwner(kTRUE); @@ -298,7 +301,7 @@ AliFMDDisplay::MakeAux() fAux = new TCanvas("aux", "Aux"); fAux->SetLogy(); if (TESTBIT(fTreeMask, kESD)) - fSpec = new TH1D("spec", "Mult spectra", 150, 0, 3); + fSpec = new TH1D("spec", "Mult spectra", 500, 0, 10); else fSpec = new TH1D("spec", "Adc spectra", 1024, -.5, 1023.5); fSpecCut = static_cast(fSpec->Clone("specCut")); @@ -336,8 +339,9 @@ AliFMDDisplay::Begin(Int_t event) if (!fCanvas) { const char* m[] = { "Continue", "Zoom", "Pick", "Redisplay", 0 }; MakeCanvas(m); - MakeAux(); } + MakeAux(); + // AliInfo("Clearing canvas"); // fCanvas->Clear(); if (!fGeoManager) { @@ -410,7 +414,7 @@ AliFMDDisplay::LookupColor(Float_t x, Float_t max) const void AliFMDDisplay::ChangeCut() { - fMultCut = fSlider->GetMinimum(); + fMultCut = fSlider->GetMinimum() * 10; fPedestalFactor = fSlider->GetMinimum() * 10; AliInfo(Form("Multiplicity cut: %7.5f, Pedestal factor: %7.4f (%6.5f)", fMultCut, fPedestalFactor, fSlider->GetMinimum())); @@ -497,8 +501,12 @@ AliFMDDisplay::ProcessDigit(AliFMDDigit* digit) UShort_t str = digit->Strip(); Double_t ped = parm->GetPedestal(det,ring, sec, str); Double_t pedW = parm->GetPedestalWidth(det,ring, sec, str); - Double_t threshold = ped * fPedestalFactor * pedW; - Float_t counts = digit->Counts(); + Double_t threshold = ped + fPedestalFactor * pedW; + Float_t counts = digit->Counts(); + AliDebug(10, Form("FMD%d%c[%2d,%3d] ADC: %d > %d (=%4.2f+%4.2f*%4.2f)", + digit->Detector(), digit->Ring(), digit->Sector(), + digit->Strip(), Int_t(counts), Int_t(threshold), + ped, fPedestalFactor, pedW)); if (fSpec) fSpec->Fill(counts); if (counts < threshold) return kTRUE; if (fHits) fHits->Add(digit); @@ -532,10 +540,9 @@ AliFMDDisplay::ProcessRecPoint(AliFMDRecPoint* recpoint) //____________________________________________________________________ Bool_t AliFMDDisplay::ProcessESD(UShort_t det, Char_t rng, UShort_t sec, UShort_t str, - Float_t eta, Float_t mult) + Float_t, Float_t mult) { - Double_t cmult = (mult * - TMath::Abs(TMath::Cos(2.*TMath::ATan(TMath::Exp(-eta))))); + Double_t cmult = mult; if (fSpec) fSpec->Fill(cmult); if (cmult < fMultCut || cmult == AliESDFMD::kInvalidMult) return kTRUE; AddMarker(det,rng,sec,str, 0, cmult, 20); diff --git a/FMD/AliFMDInput.cxx b/FMD/AliFMDInput.cxx index 281efaad7cf..8d10fa2cd51 100644 --- a/FMD/AliFMDInput.cxx +++ b/FMD/AliFMDInput.cxx @@ -55,7 +55,7 @@ #include // ROOT_TGeoManager #include // ROOT_TSystemDirectory #include // ROOT_Riostream - +#include // ROOT_TFile //____________________________________________________________________ ClassImp(AliFMDInput) #if 0 @@ -313,7 +313,16 @@ AliFMDInput::Begin(Int_t event) if (read <= 0) return kFALSE; fESD = fMainESD->GetFMDData(); if (!fESD) return kFALSE; - fESD->CheckNeedUShort(fChainE->GetFile()); + TFile* f = fChainE->GetFile(); + if (f) { + TObject* o = f->GetStreamerInfoList()->FindObject("AliFMDMap"); + if (o) { + TStreamerInfo* info = static_cast(o); + std::cout << "AliFMDMap class version read is " + << info->GetClassVersion() << std::endl; + } + } + // fESD->CheckNeedUShort(fChainE->GetFile()); } // Possibly load FMD Digit information if (TESTBIT(fTreeMask, kRaw)) { @@ -483,6 +492,8 @@ AliFMDInput::ProcessESDs() for (UShort_t str = 0; str < nstr; str++) { Float_t eta = fESD->Eta(det,*rng,sec,str); Float_t mult = fESD->Multiplicity(det,*rng,sec,str); + if (!fESD->IsAngleCorrected()) + mult *= TMath::Abs(TMath::Cos(2.*TMath::ATan(TMath::Exp(-eta)))); if (!ProcessESD(det, *rng, sec, str, eta, mult)) continue; } } diff --git a/FMD/AliFMDPattern.cxx b/FMD/AliFMDPattern.cxx index c5a7afd392f..6a1d633e3b3 100644 --- a/FMD/AliFMDPattern.cxx +++ b/FMD/AliFMDPattern.cxx @@ -85,6 +85,7 @@ void AliFMDPattern::Detector::Begin(Int_t nlevel, Double_t r, TObjArray& inners, TObjArray& outers) { + if (nlevel < 1) nlevel = gStyle->GetNumberOfColors(); fCounts.Set(nlevel); if (!fFrame) { fFrame = new TH2F(Form("fmd%dFrame", fId), Form("FMD%d", fId), @@ -226,10 +227,10 @@ AliFMDPattern::Init() Bool_t AliFMDPattern::Begin(Int_t event) { + MakeAux(); if (!fCanvas) { const char* which[] = { "Continue", "Redisplay", 0 }; MakeCanvas(which); - MakeAux(); AliFMDGeometry* geom = AliFMDGeometry::Instance(); AliFMDDetector* det; @@ -238,21 +239,21 @@ AliFMDPattern::Begin(Int_t event) fFMD1Pad = new TPad("FMD1", "FMD1", 0.0, 0.50, 0.5, 1.0, 0, 0); fFMD1Pad->Draw(); fFMD1Pad->cd(); - fFMD1.Begin(10, fInnerMax, fInners, fOuters); + fFMD1.Begin(-1, fInnerMax, fInners, fOuters); } if ((det = geom->GetDetector(2))) { fPad->cd(); fFMD2Pad = new TPad("FMD2", "FMD2", 0.5, 0.50, 1.0, 1.0, 0, 0); fFMD2Pad->Draw(); fFMD2Pad->cd(); - fFMD2.Begin(10, fOuterMax, fInners, fOuters); + fFMD2.Begin(-1, fOuterMax, fInners, fOuters); } if ((det = geom->GetDetector(3))) { fPad->cd(); fFMD3Pad = new TPad("FMD3", "FMD3", 0.0, 0.0, .5, .5, 0, 0); fFMD3Pad->Draw(); fFMD3Pad->cd(); - fFMD3.Begin(10, fOuterMax, fInners, fOuters); + fFMD3.Begin(-1, fOuterMax, fInners, fOuters); } fPad->cd(); fSummary = new TPad("display", "Display", 0.5, 0.0, 1.0, 0.5, 0, 0); diff --git a/FMD/scripts/MediaTable.C b/FMD/scripts/MediaTable.C new file mode 100644 index 00000000000..421bde3becc --- /dev/null +++ b/FMD/scripts/MediaTable.C @@ -0,0 +1,100 @@ +//____________________________________________________________________ +// +// $Id$ +// +// Script that extracts the medium numbers corresponding to each +// registered detector. +// +// Use the script `Compile.C' to compile this class using ACLic. +// +/** @file MediaTable.C + @author Christian Holm Christensen + @date Wed Dec 27 14:25:11 2006 + @brief Script to make a file with a list of medium numbers for + all active detectors. +*/ +/** Script to make a file with a list of medium numbers for all active + detectors. This should be executed in the same process as the one + that makes the @c galice.root file. For example + @code + void + Simulate() + { + AliSimulation sim; + AliLog::SetModuleDebugLevel("FMD", 1); + sim.SetConfigFile("$(ALICE_ROOT)/FMD/Config.C"); + // sim.SetMakeSDigits("FMD"); + sim.SetMakeDigits("FMD ITS VZERO T0"); + sim.SetWriteRawData("FMD"); + gROOT->Macro("$(ALICE_ROOT)/FMD/scripts/MediaTable.C"); + TStopwatch w; + w.Start(); + sim.Run(1); + w.Stop(); + w.Print(); + } + @endcode + It can also be executed after the fact, if one make sure to use + the same configuration file as the one used for the simulation. + For example + @verbatim + Root> gAlice->Init("$(ALICE_ROOT)/FMD/Config.C"); + Root> .x $ALICE_ROOT/FMD/scripts/MediaTable.C + Root> .q + @endverbatim + The idea is to use the generated file to track where particles are + produced in the simulation. This is needed to do background + studies in the FMD. The file written contains a @c TObjArray of + @c TObjString objects. The @c TObjString objects has the name of + the detector corresponding to the medium Id that the object is at + in the array. To read the file, do for example: + @code + TFile* file = TFile::Open("mediatable.root", "READ"); + TObjArray* array = (TObjArray*)(file->Get("mediatable")); + Int_t n = array->GetEntries(); + TObjString* l = 0; + Int_t min = 0; + Int_t j = 0; + for (j = 0; j < n; j++) { + TObjString* s = static_cast(array->At(j)); + if (!l || s->Compare(l) != 0) { + if (l) + std::cout << l->GetName() << "\t" << min + << "\t" << j - 1 << std::endl; + min = j; + l = s; + } + } + std::cout << l->GetName() << "\t" << min << "\t" << j << std::endl; + file->Close(); + @endcode + See also the script @c BackgroundStudy.C for more on how this is + used in the FMD collaboration. +*/ +//____________________________________________________________________ +void +MediaTable() +{ + MediaMap m; + TFile* file = TFile::Open("mediatable.root", "RECREATE"); + TObjArray* media = gAlice->Modules(); + AliModule* module = 0; + TIter next(media); + TObjArray* array = new TObjArray(media->GetEntries()); + while ((module = static_cast(next()))) { + Int_t low = module->LoMedium(); + Int_t high = module->HiMedium(); + for (Int_t j = low; j <=high; j++) { + TObjString* o = new TObjString(module->GetName()); + std::cout << "Adding " << j << ":\t" << o->GetName() << std::endl; + array->AddAtAndExpand(o, j); + } + } + array->Write("mediatable", TObject::kSingleKey); + file->Write(); + file->Close(); +} + +// +// EOF +// diff --git a/FMD/scripts/PatternDigits.C b/FMD/scripts/PatternDigits.C index 3284facff08..5866b164f56 100644 --- a/FMD/scripts/PatternDigits.C +++ b/FMD/scripts/PatternDigits.C @@ -10,8 +10,11 @@ void PatternDigits() { - // AliCDBManager* cdb = AliCDBManager::Instance(); - // cdb->SetDefaultStorage("local://$ALICE_ROOT"); + AliLog::SetModuleDebugLevel("FMD", 1); + AliCDBManager* cdb = AliCDBManager::Instance(); + cdb->SetDefaultStorage("local://$ALICE_ROOT"); + cdb->SetRun(0); + AliFMDParameters::Instance()->Init(); gSystem->Load("libFMDutil.so"); AliFMDPattern* d = new AliFMDPattern; d->AddLoad(AliFMDInput::kDigits); -- 2.43.0