Fixes for DAs after introduction of 3 LDCs (rather than 1):
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Jul 2009 09:08:34 +0000 (09:08 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 10 Jul 2009 09:08:34 +0000 (09:08 +0000)
* AliFMDBaseDA: Only write out conditions values for the detector(s)
  seen in the SOD event.
* AliFMDCalibSampleRate: Second (optional) argument of 3 booleans to
  WriteOut.  The array contains the value true of detectors which are
  seen.  Also, specify the std:: namespace explicitly, and use {i,o}stream
  instead of {i,o}fstream.
* AliFMDCalibStripRange:  As above.
* AliFMDPedestalDA:  Write only pedestal upload files for the detectors
  we've seen.
* AliFMDRawReader:  Return argument of 3 bools for detectors seen in
  SOD events.
* Elaborated some documentation

18 files changed:
FMD/AliFMDAltroMapping.h
FMD/AliFMDBackgroundCorrection.cxx
FMD/AliFMDBackgroundCorrection.h
FMD/AliFMDBaseDA.cxx
FMD/AliFMDBaseDA.h
FMD/AliFMDBoolMap.cxx
FMD/AliFMDCalibSampleRate.cxx
FMD/AliFMDCalibSampleRate.h
FMD/AliFMDCalibStripRange.cxx
FMD/AliFMDCalibStripRange.h
FMD/AliFMDEdepMap.h
FMD/AliFMDPedestalDA.cxx
FMD/AliFMDQADataMakerRec.cxx
FMD/AliFMDRawReader.cxx
FMD/AliFMDRawReader.h
FMD/FMDBaseda.cxx
FMD/FMDGainda.cxx
FMD/FMDPedestalda.cxx

index 83b1a87..ffb3ac2 100644 (file)
@@ -85,8 +85,8 @@ public:
                     Short_t& strip,      UShort_t& sample) const;
 
   /** Map a hardware address into a detector index. 
-      @param ddl    Hardware DDL number 
-      @param hwaddr Hardware address.  
+      @param ddl        Hardware DDL number 
+      @param hwaddr     Hardware address.  
       @param timebin    Timebin 
       @param preSamples # of pre samples 
       @param sampleRate Over sampling rate 
@@ -158,10 +158,10 @@ public:
                         UShort_t sampleRate) const;
   
   /** Map a detector index into a hardware address. 
-      @param det     The detector #
-      @param ring    The ring ID
-      @param sec     The sector #
-      @param str     The strip #
+      @param det         The detector #
+      @param ring        The ring ID
+      @param sec         The sector #
+      @param str         The strip #
       @param sam         The sample number 
       @param preSamples  Number of pre-samples
       @param sampleRate  The oversampling rate 
index 906c5e3..89123f8 100644 (file)
@@ -69,21 +69,21 @@ AliFMDBackgroundCorrection::AliFMDBackgroundCorrection() :
 //_____________________________________________________________________
 AliFMDBackgroundCorrection::AliFMDInputBG::AliFMDInputBG(Bool_t hits_not_trackref) 
   : AliFMDInput("galice.root"),
-  fPrimaryArray(),
-  fHitArray(),
-  fPrimaryMapInner(),
-  fPrimaryMapOuter(),
+    fPrimaryArray(),
+    fHitArray(),
+    fPrimaryMapInner(),
+    fPrimaryMapOuter(),
     fHitMap(0),           // nDetector=0 means 51200 slots
     fLastTrackByStrip(0), // nDetector=0 means 51200 slots
-  fPrim(0),
-  fHits(0),
-  fZvtxCut(0),
-  fNvtxBins(0),
-  fPrevTrack(-1),
-  fPrevDetector(-1),
-  fPrevRing('Q'),
-  fPrevSec(-1),
-  fNbinsEta(100)
+    fPrim(0),
+    fHits(0),
+    fZvtxCut(0),
+    fNvtxBins(0),
+    fPrevTrack(-1),
+    fPrevDetector(-1),
+    fPrevRing('Q'),
+    fPrevSec(-1),
+    fNbinsEta(100)
 {
   if(hits_not_trackref) {
     AddLoad(kHits);
@@ -99,16 +99,16 @@ AliFMDBackgroundCorrection::AliFMDInputBG::AliFMDInputBG(Bool_t hits_not_trackre
 
 void 
 AliFMDBackgroundCorrection::GenerateBackgroundCorrection(Bool_t from_hits,
-                                                             const Int_t nvtxbins,
-                                                             Float_t zvtxcut, 
-                                                             const Int_t nBinsEta, 
-                                                             Bool_t storeInAlien, 
-                                                             Int_t runNo,
-                                                             Int_t endRunNo, 
-                                                             const Char_t* filename, 
-                                                             Bool_t simulate,
-                                                             Int_t nEvents,
-                                                             Bool_t inFile,
+                                                        const Int_t nvtxbins,
+                                                        Float_t zvtxcut, 
+                                                        const Int_t nBinsEta, 
+                                                        Bool_t storeInAlien, 
+                                                        Int_t runNo,
+                                                        Int_t endRunNo, 
+                                                        const Char_t* filename,
+                                                        Bool_t simulate,
+                                                        Int_t nEvents,
+                                                        Bool_t inFile,
                                                         const Char_t* infilename) 
 {
   //TGrid::Connect("alien:",0,0,"t");
@@ -160,30 +160,30 @@ AliFMDBackgroundCorrection::GenerateBackgroundCorrection(Bool_t from_hits,
     primaryArray = new TObjArray();
     
     for(Int_t det =1; det<=3;det++) {
-       TObjArray* detArrayHits = new TObjArray();
-       detArrayHits->SetName(Form("FMD%d",det));
-       hitArray->AddAtAndExpand(detArrayHits,det);
-       Int_t nRings = (det==1 ? 1 : 2);
+      TObjArray* detArrayHits = new TObjArray();
+      detArrayHits->SetName(Form("FMD%d",det));
+      hitArray->AddAtAndExpand(detArrayHits,det);
+      Int_t nRings = (det==1 ? 1 : 2);
       for(Int_t ring = 0;ring<nRings;ring++) {
-           Char_t ringChar = (ring == 0 ? 'I' : 'O');
-           TObjArray* vtxArrayHits = new TObjArray();
-           vtxArrayHits->SetName(Form("FMD%d%c",det,ringChar));
-           detArrayHits->AddAtAndExpand(vtxArrayHits,ring);
+       Char_t ringChar = (ring == 0 ? 'I' : 'O');
+       TObjArray* vtxArrayHits = new TObjArray();
+       vtxArrayHits->SetName(Form("FMD%d%c",det,ringChar));
+       detArrayHits->AddAtAndExpand(vtxArrayHits,ring);
        for(Int_t v=0; v<nvtxbins;v++) {
-             
+         
          TH2F* hHits = 
            static_cast<TH2F*>(infile->Get(Form("hHits_FMD%d%c_vtx%d",
                                                det,ringChar,v)));
                
                
-             vtxArrayHits->AddAtAndExpand(hHits,v);
-                     
-           } 
-       }
+         vtxArrayHits->AddAtAndExpand(hHits,v);
+         
+       } 
+      }
     }
     
     for(Int_t iring = 0; iring<2;iring++) {
-      Char_t ringChar = (iring == 0 ? 'I' : 'O');
+      Char_t     ringChar = (iring == 0 ? 'I' : 'O');
       TObjArray* ringArray = new TObjArray();
       ringArray->SetName(Form("FMD_%c",ringChar));
       primaryArray->AddAtAndExpand(ringArray,iring);
@@ -227,7 +227,7 @@ AliFMDBackgroundCorrection::GenerateBackgroundCorrection(Bool_t from_hits,
     for(Int_t iring = 0; iring<nRings; iring++) {
       TObjArray* primRingArray      = 
        static_cast<TObjArray*>(primaryArray->At(iring));
-      Char_t ringChar = (iring == 0 ? 'I' : 'O');
+      Char_t     ringChar           = (iring == 0 ? 'I' : 'O');
       TObjArray* vtxArrayCorrection = new TObjArray();
       vtxArrayCorrection->SetName(Form("FMD%d%c",det,ringChar));
       detArrayCorrection->AddAtAndExpand(vtxArrayCorrection,iring);
@@ -386,18 +386,18 @@ AliFMDBackgroundCorrection::AliFMDInputBG::ProcessEvent(UShort_t det,
   if(nTrack == thisStripTrack) return kTRUE;
     
   fHitMap(det,ring,sec,strip) += 1;
-    fHits++;
-    Float_t nstrips = (ring =='O' ? 256 : 512);
+  fHits++;
+  Float_t nstrips = (ring =='O' ? 256 : 512);
   fLastTrackByStrip(det,ring,sec,strip)     = Float_t(nTrack);
-    if(strip >0)
+  if(strip >0)
     fLastTrackByStrip(det,ring,sec,strip-1) = Float_t(nTrack);
-    if(strip < (nstrips - 1))
+  if(strip < (nstrips - 1))
     fLastTrackByStrip(det,ring,sec,strip+1) = Float_t(nTrack);
-    
-    fPrevDetector = det;
-    fPrevRing     = ring;
-    fPrevSec      = sec;
-    fPrevTrack    = nTrack;
+  
+  fPrevDetector = det;
+  fPrevRing     = ring;
+  fPrevSec      = sec;
+  fPrevTrack    = nTrack;
   
   return kTRUE;
 
@@ -480,10 +480,10 @@ Bool_t AliFMDBackgroundCorrection::AliFMDInputBG::Begin(Int_t event )
     TParticlePDG* pdgPart  = pdgDB->GetParticle(p->GetPdgCode());
     Float_t       charge   = (pdgPart ? pdgPart->Charge() : 0);
     if (charge == 0) continue;
-    
+
     Float_t   phi = TMath::ATan2(p->Py(),p->Px());
     if(phi<0) phi = phi+2*TMath::Pi();
-    Float_t eta   = p->Eta();   
+    Float_t   eta = p->Eta();   
     
     // std::cout<<-1*TMath::Log(TMath::Tan(0.5*p->Theta()))<<std::endl;
     
@@ -491,11 +491,11 @@ Bool_t AliFMDBackgroundCorrection::AliFMDInputBG::Begin(Int_t event )
     //(charge!=0)&&(TMath::Abs(p->Vx() - vertex.At(0))<0.01)&&(TMath::Abs(p->Vy() - vertex.At(1))<0.01)&&(TMath::Abs(p->Vz() - vertex.At(2))<0.01);
     if(!primary) continue;
       
-      fPrim++;
-      
-      fPrimaryMapInner.Fill(eta,phi);
-      fPrimaryMapOuter.Fill(eta,phi);
-    }
+    fPrim++;
+    
+    fPrimaryMapInner.Fill(eta,phi);
+    fPrimaryMapOuter.Fill(eta,phi);
+  }
   
   return retVal;
 }
index c9e80bd..b0d0cf7 100644 (file)
@@ -54,17 +54,17 @@ public:
    * @param inFile        Whether an input file is specified
    * @param infilename    Input file name
    */
-  void GenerateBackgroundCorrection(Bool_t from_hits=kFALSE,
-                                   Int_t nvtxbins=10,
-                                   Float_t zvtxcut=10,
-                                   Int_t nBinsEta=100, 
-                                   Bool_t storeInAlien = kFALSE, 
-                                   Int_t runNo =0, 
-                                   Int_t endRunNo=999999999, 
-                                   const Char_t* filename="background.root", 
-                                   Bool_t simulate = kFALSE, 
-                                   Int_t nEvents=10,
-                                   Bool_t inFile = kFALSE,
+  void GenerateBackgroundCorrection(Bool_t        from_hits    = kFALSE,
+                                   Int_t         nvtxbins     = 10,
+                                   Float_t       zvtxcut      = 10,
+                                   Int_t         nBinsEta     = 100, 
+                                   Bool_t        storeInAlien = kFALSE, 
+                                   Int_t         runNo        = 0, 
+                                   Int_t         endRunNo     = 999999999, 
+                                   const Char_t* filename  ="background.root", 
+                                   Bool_t        simulate     = kFALSE, 
+                                   Int_t         nEvents      = 10,
+                                   Bool_t        inFile       = kFALSE,
                                    const Char_t* infilename="");
   /** 
    * Nested class that derives from AliFMDInput to do the actual
@@ -72,7 +72,7 @@ public:
    */  
   class AliFMDInputBG : public AliFMDInput 
   {
-  
+    
   public :
     //AliFMDInputBG() ; 
     /** 
@@ -88,7 +88,7 @@ public:
      * @return @c true on success.
      */
     Bool_t Init();
-    
+
     /** 
      * Get number of primaries seen
      * 
index 2cb422c..82debd4 100644 (file)
@@ -96,6 +96,7 @@ AliFMDBaseDA::AliFMDBaseDA() :
   fRequiredEvents(0),
   fCurrentEvent(0)
  {
+   fSeenDetectors[0] = fSeenDetectors[1] = fSeenDetectors[2] = kFALSE;
   fDetectorArray.SetOwner();
   fConditionsFile.open("conditions.csv");
 }
@@ -112,6 +113,10 @@ AliFMDBaseDA::AliFMDBaseDA(const AliFMDBaseDA & baseDA) :
   fRequiredEvents(baseDA.fRequiredEvents),
   fCurrentEvent(baseDA.fCurrentEvent)
 {
+  fSeenDetectors[0] = baseDA.fSeenDetectors[0];
+  fSeenDetectors[1] = baseDA.fSeenDetectors[1];
+  fSeenDetectors[2] = baseDA.fSeenDetectors[2];
+
   fDetectorArray.SetOwner();
   
 }
@@ -170,12 +175,9 @@ void AliFMDBaseDA::Run(AliRawReader* reader)
     digitArray->Clear();
     fmdReader->ReadAdcs(digitArray);
     
-    //std::cout<<"in event "<<*(reader->GetEventId())<<"   "<<n<<std::endl;
-    //AliDebug(5, Form("In event # %d with %d entries", 
-    //              *(reader->GetEventId()), digitArray->GetEntriesFast()));
-    
     for(Int_t i = 0; i<digitArray->GetEntriesFast();i++) {
       AliFMDDigit* digit = static_cast<AliFMDDigit*>(digitArray->At(i));
+      fSeenDetectors[digit->Detector()-1] = kTRUE;
       FillChannels(digit);
     }
     
@@ -193,6 +195,7 @@ void AliFMDBaseDA::Run(AliRawReader* reader)
   WriteHeaderToFile();
   
   for(UShort_t det=1;det<=3;det++) {
+    if (!fSeenDetectors[det-1]) continue;
     std::cout << "FMD" << det << std::endl;
     UShort_t FirstRing = (det == 1 ? 1 : 0);
     for (UShort_t ir = FirstRing; ir < 2; ir++) {
@@ -300,41 +303,11 @@ void AliFMDBaseDA::WriteConditionsData(AliFMDRawReader* fmdReader)
   AliFMDCalibSampleRate* sampleRate = new AliFMDCalibSampleRate();
   AliFMDCalibStripRange* stripRange = new AliFMDCalibStripRange();
   
-  fmdReader->ReadSODevent(sampleRate,stripRange,fPulseSize,fPulseLength);
-  
-  // Sample Rate
-  /*
-    UShort_t defSampleRate = 4;
-    UShort_t sampleRateFromSOD;
-    
-  AliFMDCalibSampleRate* sampleRate = new AliFMDCalibSampleRate();
+  fmdReader->ReadSODevent(sampleRate,stripRange,fPulseSize,fPulseLength,
+                         fSeenDetectors);
 
-  UShort_t firstStrip = 0;
-  UShort_t lastStrip  = 127;
-  UShort_t firstStripSOD;
-  UShort_t lastStripSOD;
-  AliFMDCalibStripRange* stripRange = new AliFMDCalibStripRange();
-  
-  for(Int_t det=1;det<=3;det++) {
-    UShort_t FirstRing = (det == 1 ? 1 : 0);
-    for (UShort_t ir = FirstRing; ir < 2; ir++) {
-      Char_t   ring = (ir == 0 ? 'O' : 'I');
-      UShort_t nsec = (ir == 0 ? 40  : 20);
-      for(UShort_t sec =0; sec < nsec;  sec++)  {
-       sampleRateFromSOD = defSampleRate;
-       sampleRate->Set(det,ring,sec,0,sampleRateFromSOD);
-       firstStripSOD = firstStrip;
-       lastStripSOD  = lastStrip;
-       stripRange->Set(det,ring,sec,0,firstStripSOD,lastStripSOD);
-       
-      }
-    }
-  }
-  */
-  sampleRate->WriteToFile(fConditionsFile);
-  stripRange->WriteToFile(fConditionsFile);
-  //pars->SetSampleRate(sampleRate);
-  //pars->SetStripRange(stripRange);
+  sampleRate->WriteToFile(fConditionsFile, fSeenDetectors);
+  stripRange->WriteToFile(fConditionsFile, fSeenDetectors);
 
  
   // Zero Suppresion
@@ -344,6 +317,9 @@ void AliFMDBaseDA::WriteConditionsData(AliFMDRawReader* fmdReader)
   fConditionsFile.write("# Gain Events \n",15);
   
   for(UShort_t det=1; det<=3;det++) {
+    if (!fSeenDetectors[det-1]) { 
+      continue;
+    }
     UShort_t firstring = (det == 1 ? 1 : 0);
     for(UShort_t iring = firstring; iring <=1;iring++) {
       Char_t ring = (iring == 1 ? 'I' : 'O');
@@ -363,6 +339,9 @@ void AliFMDBaseDA::WriteConditionsData(AliFMDRawReader* fmdReader)
   fConditionsFile.write("# Gain Pulse \n",14);
   
   for(UShort_t det=1; det<=3;det++) {
+    if (!fSeenDetectors[det-1]) { 
+      continue;
+    }
     UShort_t firstring = (det == 1 ? 1 : 0);
     for(UShort_t iring = firstring; iring <=1;iring++) {
       Char_t ring = (iring == 1 ? 'I' : 'O');
@@ -378,33 +357,6 @@ void AliFMDBaseDA::WriteConditionsData(AliFMDRawReader* fmdReader)
       }
     }
   }
-  
-  
-
-  // Gain Relevant stuff
-  /*
-  UShort_t defPulseSize = 32 ; 
-  UShort_t defPulseLength = 100 ; 
-  UShort_t pulseSizeFromSOD;
-  UShort_t pulseLengthFromSOD;  
-  
-  fPulseSize.Reset(defPulseSize);
-  fPulseLength.Reset(defPulseLength);
-  
-  for(UShort_t det=1;det<=3;det++)
-    for(UShort_t iring=0;iring<=1;iring++)
-      for(UShort_t board=0;board<=1;board++) {
-       pulseSizeFromSOD = defPulseSize;
-       pulseLengthFromSOD = defPulseLength;
-
-       fPulseSize.AddAt(pulseSizeFromSOD,GetHalfringIndex(det,iring,board));
-       fPulseLength.AddAt(pulseLengthFromSOD,GetHalfringIndex(det,iring,board));
-      }
-         
-  
-  //  fConditionsFile     << defSampleRate   << ',' 
-  //                 << timebins     <<"\n";
-  */
   if(fConditionsFile.is_open()) {
     
     fConditionsFile.write("# EOF\n",6);
index 2077edc..85e6375 100644 (file)
@@ -88,6 +88,7 @@ protected:
   TArrayS fPulseSize;
   TArrayS fPulseLength;
 
+  Bool_t  fSeenDetectors[3];
 private:
  
   void WriteConditionsData(AliFMDRawReader* fmdReader);
index f2fd938..3a7b86e 100644 (file)
@@ -62,9 +62,9 @@ AliFMDBoolMap::AliFMDBoolMap()
 
 //__________________________________________________________
 AliFMDBoolMap::AliFMDBoolMap(UShort_t maxDet,
-                         UShort_t maxRing,
-                         UShort_t maxSec,
-                         UShort_t maxStr)
+                            UShort_t maxRing,
+                            UShort_t maxSec,
+                            UShort_t maxStr)
   : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
     fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
     fData(0)
index c0b4279..32ad46c 100644 (file)
@@ -31,7 +31,7 @@
 // #include <AliLog.h>
 #include "TString.h"
 #include "AliFMDDebug.h" // Better debug macros
-#include "iostream"
+#include <iostream>
 
 //____________________________________________________________________
 ClassImp(AliFMDCalibSampleRate)
@@ -91,10 +91,13 @@ AliFMDCalibSampleRate::Rate(UShort_t det, Char_t ring,
 }
 //____________________________________________________________________
 void 
-AliFMDCalibSampleRate::WriteToFile(ofstream &outFile)
+AliFMDCalibSampleRate::WriteToFile(std::ostream &outFile, Bool_t* detectors)
 {
   outFile.write("# SampleRate \n",14);
   for(Int_t det=1;det<=3;det++) {
+    if (detectors && !detectors[det-1]) { 
+      continue;
+    }
     UShort_t FirstRing = (det == 1 ? 1 : 0);
     for (UShort_t ir = FirstRing; ir < 2; ir++) {
       Char_t   ring = (ir == 0 ? 'O' : 'I');
@@ -115,7 +118,7 @@ AliFMDCalibSampleRate::WriteToFile(ofstream &outFile)
 }
 //____________________________________________________________________
 void 
-AliFMDCalibSampleRate::ReadFromFile(ifstream &inFile)
+AliFMDCalibSampleRate::ReadFromFile(std::istream &inFile)
 {
   TString line;
   Bool_t readData=kFALSE;
index 0567a0c..0fef70c 100644 (file)
@@ -20,9 +20,7 @@
     @ingroup FMD_base    
 */
 
-#ifndef FSTREAM
-# include <fstream>
-#endif
+#include <iosfwd>
 #ifndef ROOT_TObject
 # include <TObject.h>
 #endif
@@ -66,11 +64,11 @@ public:
   /** Write stored samplerates to file
       @param outFile Output file stream
    */
-  void WriteToFile(ofstream &);
+  void WriteToFile(std::ostream & outFile, Bool_t* detectors=0);
   /** Read information from file and set sample rates
       @param inFile input file stream
    */
-  void ReadFromFile(ifstream &);
+  void ReadFromFile(std::istream & inFile);
 protected:
   // TArrayI fRates; // Sample rates 
   AliFMDUShortMap fRates; // Sample rates
index d3a8675..3372918 100644 (file)
@@ -26,7 +26,7 @@
 // strips, and dead areas can be handled off-line. 
 // This information comes from DCS or the like.
 //
-#include "iostream"
+#include <iostream>
 #include "AliFMDCalibStripRange.h"     // ALIFMDCALIBGAIN_H
 #include "TString.h"
 // #include "AliFMDParameters.h"           // ALIFMDPARAMETERS_H
@@ -98,10 +98,13 @@ AliFMDCalibStripRange::Max(UShort_t det, Char_t ring,
 }
 //____________________________________________________________________
 void 
-AliFMDCalibStripRange::WriteToFile(ofstream &outFile)
+AliFMDCalibStripRange::WriteToFile(std::ostream &outFile, Bool_t* detectors)
 {
   outFile.write("# StripRange \n",14);
   for(Int_t det=1;det<=3;det++) {
+    if (detectors && !detectors[det-1]) { 
+      continue;
+    }
     UShort_t FirstRing = (det == 1 ? 1 : 0);
     for (UShort_t ir = FirstRing; ir < 2; ir++) {
       Char_t   ring = (ir == 0 ? 'O' : 'I');
@@ -121,7 +124,7 @@ AliFMDCalibStripRange::WriteToFile(ofstream &outFile)
 }
 //____________________________________________________________________
 void 
-AliFMDCalibStripRange::ReadFromFile(ifstream &inFile)
+AliFMDCalibStripRange::ReadFromFile(std::istream &inFile)
 {
   TString line;
   Bool_t readData=kFALSE;
index b4a41df..b9fc7c4 100644 (file)
@@ -19,9 +19,7 @@
     @brief   Per digitizer card pulser calibration
     @ingroup FMD_base
 */
-#ifndef FSTREAM
-# include <fstream>
-#endif
+#include <iosfwd>
 #ifndef ROOT_TObject
 # include <TObject.h>
 #endif
@@ -75,12 +73,12 @@ public:
      Dump stored strip ranges to file passed as ofstream
      @param outFile Outputfile
   */
-  void WriteToFile(ofstream &);
+  void WriteToFile(std::ostream &, Bool_t* detectors=0);
   /**
      Read information from file and set values
      @param inFile inputFile
    */
-  void ReadFromFile(ifstream &);
+  void ReadFromFile(std::istream &);
   
 protected:
   // TArrayI fRates; // Sample rates 
index f586d13..0bab877 100644 (file)
@@ -88,7 +88,7 @@ protected:
   UShort_t& AtAsUShort(Int_t idx)       { return fData[idx].fN; }
   Bool_t    IsUShort()            const { return kTRUE; }  
   Bool_t    IsFloat()             const { return kTRUE; }  
-  Int_t             fTotal; //  Total number of entries
+  Int_t              fTotal; //  Total number of entries
   AliFMDEdepHitPair* fData;  //[fTotal] The data 
   ClassDef(AliFMDEdepMap, 3) // Cache of edep,hit information per strip
 };
index 959b0da..6edf649 100644 (file)
 
 #include "AliFMDPedestalDA.h"
 #include "AliFMDAltroMapping.h"
-#include "iostream"
-#include "fstream"
+#include <iostream>
+#include <fstream>
 #include "AliLog.h"
 #include "TF1.h"
 #include "TObject.h"
 #include "TMath.h"
+#include <TSystem.h>
 
 //_____________________________________________________________________
 ClassImp(AliFMDPedestalDA)
@@ -295,6 +296,12 @@ void AliFMDPedestalDA::Terminate(TFile* diagFile)
   if(fZSfileFMD1.is_open()) FillinTimebins(fZSfileFMD1, map->Detector2DDL(1));
   if(fZSfileFMD2.is_open()) FillinTimebins(fZSfileFMD2, map->Detector2DDL(2));
   if(fZSfileFMD3.is_open()) FillinTimebins(fZSfileFMD3, map->Detector2DDL(3));
+  for (Int_t i = 0; i < 3; i++) {
+    if (!fSeenDetectors[i]) {
+      TString n(Form("ddl%d.csv",3072+map->Detector2DDL(i+1)));
+      gSystem->Unlink(n.Data());
+    }
+  }
   
 }
 
index c8f4aa2..20250d8 100644 (file)
@@ -179,6 +179,24 @@ void AliFMDQADataMakerRec::InitRaws()
   }
 }
 
+#if 0
+struct FillESDHist : public AliESDFMD::ForOne
+{
+  FillESDHist(AliFMDQADataMakerRec* m) : fM(m) {}
+  FillESDHist(const FillESDHist& o) : fM(o.fM) {}
+  FillESDHist& operator=(const FillESDHist& o) { fM = o.fM; return *this;  }
+  Bool_t operator()(UShort_t, Char_t, UShort_t, UShort_t, Float_t m, Float_t) 
+  {
+    // Float_t mult = fmd->Multiplicity(det,ring,sec,strip);
+    if(m == AliESDFMD::kInvalidMult) return true;
+    
+    fM->GetESDsData(0)->Fill(m);    
+    return true;
+  }
+  AliFMDQADataMakerRec* fM;
+};
+#endif
+
 //_____________________________________________________________________
 void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
 {
@@ -191,6 +209,13 @@ void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
   AliESDFMD* fmd = esd->GetFMDData();
   if (!fmd) return;
 
+#if 0
+  FillESDHist f(this);
+  fmd->ForEach(f);
+#else
+
+
+
   // FIXME - we should use AliESDFMD::ForOne subclass to do this!
   for(UShort_t det=1;det<=3;det++) {
     UShort_t nrng = (det == 1 ? 1 : 2);
@@ -208,6 +233,7 @@ void AliFMDQADataMakerRec::MakeESDs(AliESDEvent * esd)
       }
     }
   }
+#endif
 }
 
 
index f2c0520..a514ef0 100644 (file)
@@ -650,7 +650,8 @@ AliFMDRawReader::Exec(Option_t*)
 Bool_t AliFMDRawReader::ReadSODevent(AliFMDCalibSampleRate* sampleRate, 
                                     AliFMDCalibStripRange* stripRange, 
                                     TArrayS &pulseSize, 
-                                    TArrayS &pulseLength) 
+                                    TArrayS &pulseLength, 
+                                    Bool_t* detectors) 
 {
 
   AliFMDDebug(0, ("Start of SOD/EOD"));
@@ -668,6 +669,7 @@ Bool_t AliFMDRawReader::ReadSODevent(AliFMDCalibSampleRate* sampleRate,
     
     Int_t ddl   = fReader->GetDDLID();
     Int_t detID = fReader->GetDetectorID();
+    if (detectors) detectors[map->DDL2Detector(ddl)-1] = kTRUE;
     AliFMDDebug(0, (" From reader: DDL number is %d , det ID is %d",ddl,detID));
     
     fNbytes = fReader->GetDataSize();
index e21d8b8..fa5cbdb 100644 (file)
@@ -89,7 +89,8 @@ public:
   virtual Bool_t ReadSODevent(AliFMDCalibSampleRate* samplerate, 
                              AliFMDCalibStripRange* striprange, 
                              TArrayS &pulseSize, 
-                             TArrayS &pulseLength);
+                             TArrayS &pulseLength, 
+                             Bool_t* detectors=0);
   /** 
    * Check of the data from DDL @a ddl is zero-suppressed
    * 
index ba6e175..1f91e45 100644 (file)
@@ -50,6 +50,10 @@ int main(int argc, char **argv)
   struct eventHeaderStruct *event;
   int status;
   /* define data source : this is argument 1 */  
+  if (argc < 2) { 
+    std::cout << "No monitor source set" << std::endl;
+    return -1;
+  }
   status=monitorSetDataSource( argv[1] );
   if (status!=0) {
     printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
index fe865ca..c681a52 100644 (file)
@@ -40,19 +40,23 @@ int main(int argc, char **argv)
   Char_t* fileName = argv[1];
   TString secondArgument(argv[2]);
   
-  if(secondArgument.Contains("--diagnostics=true"))
-    diagnostics = kTRUE;
-  if(secondArgument.Contains("--help")) {
-    std::cout<<"Usage: filename --diagnostics=true/false . --help this help"<<std::endl;
-    return 0;
+  for (int i = 2; i < argc; i++) { 
+    TString arg(argv[i]);
+    if      (arg.Contains("--diagnostics=true")) diagnostics = kTRUE;
+    else if (arg.Contains("--help")) { 
+      std::cout << "Usage: " << argv[0] << " FILENAME [OPTIONS]\n\n"
+               << "Options:\n" 
+               << "    --diagnostics=BOOL Make diagnostics ROOT file\n"
+               << std::endl;
+      return 0;
+    }
+    else { 
+      std::cerr << "Unknown option: " << arg << "\n"
+               << "Try '" << argv[0] << " --help" << std::endl;
+      return 1;
+    }
   }
-  if(!secondArgument.IsWhitespace()&& !secondArgument.Contains("--help") 
-     && !secondArgument.Contains("--diagnostics=true")) {
-    std::cout<<"Second argument wrong. Use --help"<<std::endl;
-    return -1;
-  }
-    
-    Bool_t old = kTRUE;
+  Bool_t old = kTRUE;
     
   AliFMDParameters::Instance()->Init(kFALSE,0);
 
index 3aa9645..aa6a0f9 100644 (file)
@@ -38,19 +38,21 @@ int main(int argc, char **argv)
   
   Bool_t diagnostics = kFALSE;
   Char_t* fileName = argv[1];
-  TString secondArgument(argv[2]);
-  
-  if(secondArgument.Contains("--diagnostics=true"))
-    diagnostics = kTRUE;
-  if(secondArgument.Contains("--help")) {
-    std::cout<<"Usage: filename --diagnostics=true/false . --help this help"<<std::endl;
-    return 0;
-  }
-  
-  if(!secondArgument.IsWhitespace() && !secondArgument.Contains("--help") 
-     && !secondArgument.Contains("--diagnostics=true")) {
-    std::cout<<"Second argument wrong. Use --help"<<std::endl;
-    return -1;
+  for (int i = 2; i < argc; i++) { 
+    TString arg(argv[i]);
+    if      (arg.Contains("--diagnostics=true")) diagnostics = kTRUE;
+    else if (arg.Contains("--help")) { 
+      std::cout << "Usage: " << argv[0] << " FILENAME [OPTIONS]\n\n"
+               << "Options:\n" 
+               << "    --diagnostics=BOOL Make diagnostics ROOT file\n"
+               << std::endl;
+      return 0;
+    }
+    else { 
+      std::cerr << "Unknown option: " << arg << "\n"
+               << "Try '" << argv[0] << " --help" << std::endl;
+      return 1;
+    }
   }
   Bool_t old = kTRUE;