X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONSDigitizerV2.cxx;h=6dc06e05bd07180da0444b321b1d9ab3108534b1;hb=852fefb44eb9605f120a2d05c5180cc61eb6382b;hp=a7a589f3065fc7c600eee8a977924c14db15647e;hpb=3d1463c8f7148e36069c24f20cde34e096d5d6a9;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONSDigitizerV2.cxx b/MUON/AliMUONSDigitizerV2.cxx index a7a589f3065..6dc06e05bd0 100644 --- a/MUON/AliMUONSDigitizerV2.cxx +++ b/MUON/AliMUONSDigitizerV2.cxx @@ -16,21 +16,31 @@ // $Id$ #include +#include +#include #include "AliMUONSDigitizerV2.h" -#include "AliLog.h" #include "AliMUON.h" #include "AliMUONChamber.h" #include "AliMUONVDigit.h" #include "AliMUONHit.h" -#include "AliMpDEManager.h" +#include "AliMUONVDigitStore.h" +#include "AliMUONVHitStore.h" +#include "AliMUONResponseTrigger.h" +#include "AliMUONConstants.h" + #include "AliMpCDB.h" +#include "AliMpDEManager.h" + +#include "AliLog.h" +#include "AliCDBManager.h" #include "AliLoader.h" #include "AliRun.h" #include "AliRunLoader.h" -#include "AliMUONVDigitStore.h" -#include "AliMUONVHitStore.h" + +#include "AliHeader.h" +#include "AliGenCocktailEventHeader.h" //----------------------------------------------------------------------------- /// The sdigitizer performs the transformation from hits (energy deposits by @@ -50,15 +60,21 @@ ClassImp(AliMUONSDigitizerV2) +Float_t AliMUONSDigitizerV2::fgkMaxIntTime = 10.0; +Float_t AliMUONSDigitizerV2::fgkMaxPosTimeDif = 1.22E-6; +Float_t AliMUONSDigitizerV2::fgkMaxNegTimeDif = -3.5E-6; +Float_t AliMUONSDigitizerV2::fgkMinTimeDif = 25E-9; + //_____________________________________________________________________________ AliMUONSDigitizerV2::AliMUONSDigitizerV2() -: TTask("AliMUONSDigitizerV2","From Hits to SDigits for MUON") +: TNamed("AliMUONSDigitizerV2","From Hits to SDigits for MUON") { /// /// ctor. /// - if ( ! AliMpCDB::LoadMpSegmentation() ) - { + + // Load mapping + if ( ! AliMpCDB::LoadMpSegmentation() ) { AliFatal("Could not access mapping from OCDB !"); } } @@ -73,7 +89,7 @@ AliMUONSDigitizerV2::~AliMUONSDigitizerV2() //_____________________________________________________________________________ void -AliMUONSDigitizerV2::Exec(Option_t*) +AliMUONSDigitizerV2::Digitize(Option_t*) { /// /// Go from hits to sdigits. @@ -86,13 +102,13 @@ AliMUONSDigitizerV2::Exec(Option_t*) AliDebug(1,""); - AliRunLoader* runLoader = AliRunLoader::GetRunLoader(); + AliRunLoader* runLoader = AliRunLoader::Instance(); AliLoader* loader = runLoader->GetDetectorLoader("MUON"); - + loader->LoadHits("READ"); AliMUON* muon = static_cast(gAlice->GetModule("MUON")); - + Int_t nofEvents(runLoader->GetNumberOfEvents()); TString classname = muon->DigitStoreClassName(); @@ -104,8 +120,10 @@ AliMUONSDigitizerV2::Exec(Option_t*) AliFatal(Form("Could not create digitstore of class %s",classname.Data())); } - AliInfo(Form("Will use digitStore of type %s",sDigitStore->ClassName())); - + AliDebug(1,Form("Will use digitStore of type %s",sDigitStore->ClassName())); + + // average arrival time to chambers, for pileup studies + for ( Int_t iEvent = 0; iEvent < nofEvents; ++iEvent ) { // Loop over events. @@ -114,20 +132,52 @@ AliMUONSDigitizerV2::Exec(Option_t*) AliDebug(1,Form("iEvent=%d",iEvent)); runLoader->GetEvent(iEvent); - + + // for pile up studies + float t0=fgkMaxIntTime; int aa=0; + AliHeader* header = runLoader->GetHeader(); + AliGenCocktailEventHeader* cocktailHeader = + dynamic_cast(header->GenEventHeader()); + if (cocktailHeader) { + AliGenCocktailEventHeader* genEventHeader = (AliGenCocktailEventHeader*) (header->GenEventHeader()); + TList* headers = genEventHeader->GetHeaders(); + TIter nextH(headers); + AliGenEventHeader *entry; + while((entry = (AliGenEventHeader*)nextH())) { + float t = entry->InteractionTime(); + if (TMath::Abs(t)GenEventHeader()); + if (evtHeader) + { + float t = evtHeader->InteractionTime(); + if (TMath::Abs(t)MakeSDigitsContainer(); - + TTree* treeS = loader->TreeS(); - + if ( !treeS ) { AliFatal(""); } - + sDigitStore->Connect(*treeS); TTree* treeH = loader->TreeH(); - + AliMUONVHitStore* hitStore = AliMUONVHitStore::Create(*treeH); hitStore->Connect(*treeH); @@ -137,7 +187,7 @@ AliMUONSDigitizerV2::Exec(Option_t*) { // Loop over the tracks of this event. treeH->GetEvent(iTrack); - + AliMUONHit* hit; TIter next(hitStore->CreateIterator()); Int_t ihit(0); @@ -145,21 +195,39 @@ AliMUONSDigitizerV2::Exec(Option_t*) while ( ( hit = static_cast(next()) ) ) { Int_t chamberId = hit->Chamber()-1; + Float_t age = hit->Age()-t0; + AliMUONChamber& chamber = muon->Chamber(chamberId); AliMUONResponse* response = chamber.ResponseModel(); // This is the heart of this method : the dis-integration TList digits; - response->DisIntegrate(*hit,digits); + if (aa>1){ // if there are pileup events + Float_t chamberTime = AliMUONConstants::AverageChamberT(chamberId); + Float_t timeDif=age-chamberTime; + if (timeDif>fgkMaxPosTimeDif || timeDiffgkMinTimeDif){ + response->DisIntegrate(*hit,digits,timeDif); + } + else{ + response->DisIntegrate(*hit,digits,0.); + } + } + else{ + response->DisIntegrate(*hit,digits,0.); + } - TIter next(&digits); + TIter nextd(&digits); AliMUONVDigit* d; - while ( ( d = (AliMUONVDigit*)next() ) ) + while ( ( d = (AliMUONVDigit*)nextd() ) ) { // Update some sdigit information that could not be known // by the DisIntegrate method d->SetHit(ihit); - d->AddTrack(iTrack,d->Charge()); + d->SetTime(age); + d->AddTrack(hit->GetTrack(),d->Charge()); tdlist.Add(d); } ++ihit; @@ -172,17 +240,15 @@ AliMUONSDigitizerV2::Exec(Option_t*) while ( ( d = static_cast(next()) ) ) { - if ( d->Charge() > 0 ) // that check would be better in the disintegrate - // method, but to compare with old sdigitizer, it has to be there. + d->ChargeInFC(kTRUE); + + AliMUONVDigit* added = sDigitStore->Add(*d,AliMUONVDigitStore::kMerge); + if (!added) { - AliMUONVDigit* added = sDigitStore->Add(*d,AliMUONVDigitStore::kMerge); - if (!added) - { - AliError("Could not add digit to digitStore"); - } + AliError("Could not add digit to digitStore"); } } - + treeS->Fill(); loader->WriteSDigits("OVERWRITE"); @@ -198,4 +264,5 @@ AliMUONSDigitizerV2::Exec(Option_t*) loader->UnloadHits(); delete sDigitStore; + }